What is the maximum size of a file that can be uploaded using PHP and how can you change this?
By default, the maximum upload size in PHP is 2MB. This is kept in the php.ini file. To allow for the upload of larger files you have 3 options.Change the php.ini file. You're going to go into your php.ini file and look for the lines: memory_limit = 8Mpost_max_size = 8Mupload_max_filesize = 2MYou want to change the upload_max_filesize. Make sure that you don't exceed the post_max_size (if you do, then change them both.) Also, it's a good idea to make sure that memory_limit is always larger than post_max_size. (This applies to all these solutions.)After making changes to php.ini, your webserver will need to be restarted.Assuming you can't get into php.ini, you're using Apache, and you're running PHP as a module, you can use an .htaccess file. That file should contain the following lines: php_flag file_uploads Onphp_value memory_limit 8Mphp_value post_max_size 8Mphp_value upload_max_filesize 2MYou put the .htaccess file in the root web folder, and it will apply to all the folders beneath it. If you do this and the server gives you a HTTP code 500 "Internal Server Error" then you aren't running Apache as a module and you can't do it this way. If it doesn't so anything, it's possible that you don't have the permissions to overwrite the Apache config via .htaccess.Finally, if all else fails, you can attempt to add a php.ini file to the webroot. PHP should find this ini file and abide by it. You don't need to copy every setting (anything not here is still in the original.) So your file should look something like this: [PHP]; Whether to allow HTTP fileuploads. file_uploads = On; Maximum amount of memory a script may consume (8MB)memory_limit = 8M; Maximum size of POST data that PHP will accept.post_max_size = 8M; Maximum allowed size for uploaded files.upload_max_filesize = 2MIf that technique fails, then it's time to admit defeat and call your hosting provider or IT guys and ask, politely, that they fix this for you.