How can I upload files larger than 2MB in PHP,I searched the Internet and i changed the php.ini
file,the line is: "upload_max_filesize = 200M"
,but I still can't upload even 2 MB file.
What seems to be the problem?
Please help me.Thanks in advance.
By changing the upload_max_filesize limit in the php. ini file. By implementing file chunk upload, that splits the upload into smaller pieces an assembling these pieces when the upload is completed.
To increaes file upload size in PHP, you need to modify the upload_max_filesize and post_max_size variable's in your php. ini file. In addition, you can also set the maximum number of files allowed to be uploaded simultaneously, in a single request, using the max_file_uploads . Note that from PHP 5.3.
by default PHP will not handle file uploads larger than 2MB, if one requires PHP to handle larger files then one must set upload_max_filesize and post_max_size in your php. ini file to be larger than 2MB.
Once upon a time I'm facing this problem with my WAMP server, and when I search for solution, I stumbled upon to this discussion. So, if someone have the same problem, this is my working solution, I hope this help:
I'm using WAMP stack. By reading your comment above, you are using WAMP stack too. In case you don't know, WAMP server has 2 (two) php.ini (in PHP directory and Apache directory) configuration, one for CLI and the other for Apache itself ( see php.ini on WAMP server ). So, I create info.php to detect which php.ini use by my server, and in my case that is the one in Apache directory ( see Which PHP Ini file does my WAMP webpage uses?).
Open your php.ini that used by your server, and as @Pascal Martin suggested, change upload_max_filesize
and also set post_max_size
then restart your server.
Check again your info.php, make sure the value of upload_max_filesize
and post_max_size
has changed to your desired value.
Restart Apache.
It's worked for me, hope this help.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With