How to Increase PHP’s File Upload Limit Using php.ini
The file upload size limit 2M(Approx) is set by shared hosting providers. They have set it low because it save bandwidth, keep the server moving quickly.
But customers really need a large upload limit? So we must increase the file upload size limit. We can do it by 4 way :
1- By adding below code on the page where you have upload function
ini_set(‘memory_limit’, ‘256M’); //needs to be in {x}M format
ini_set(‘upload_max_filesize’, ’50M’); //needs to be in {x}M format
ini_set(‘post_max_size’, ’50M’); //needs to be in {x}M format
2- Using below code in php.ini file
memory_limit = 256M
upload_max_filesize = 50M
post_max_size = 50M
Make php.ini file and upload it on the root folder
3- Using .htaccess file (Add below code in this file)
php_value memory_limit 256M
php_value upload_max_filesize 50M
php_value post_max_size 50M
4- Finally if above 3 tricks not work, then you need to contact to your hosting provider.
Leave a Reply
Want to join the discussion?Feel free to contribute!