When trying to upload a PDF
file that was 15mb through an admin area created for doing so, nothing happened. There was no success or error message, but the PDF
did not upload.
I then thought that it could be an issue with the php.ini
settings. Sure enough, when I looked at the file, I found that the limits were set to 8m. Which I'm assuming means 8mb.
post_max_size: http://php.net/post-max-size
; Maximum size of POST data that PHP will accept. ; Its value may be 0 to disable the limit. It is ignored if POST data reading ; is disabled through enable_post_data_reading. post_max_size = 20M
upload_max_filesize: http://php.net/upload-max-filesize
; Maximum allowed size for uploaded files. upload_max_filesize = 20M
Looking at the comments, it appears that one is for files being uploaded, while the other relates directly to POST
data. What I'm confused about is this scenario: If you have a form that is POST
'ing an image to another page, what does that count as, upload_max_filesize
or post_max_size
? Does it fall under both? Does one take precedence? Are there cases where one would be used and not the other?
Edit:
So if I have a form that has 3 file inputs, all allowing files 20mb or smaller, the settings would have to be set like so:
upload_max_filesize = 20M post_max_size = 60M
In order to preserve your server's resources, hosts set a limit on the maximum size of a file that can be uploaded. This maximum, in megabytes, is defined in the upload_max_filesize directive. The upload_max_filesize directive itself is located in the php.
Navigate to your php.Locate the upload_max_filesize and increase it by changing its number. You can also boost a few other limitations, as shown below: upload_max_filesize = 256M post_max_size = 256M memory_limit = 512M max_execution_time = 180. Save the file, and that's it. The error should no longer occur.
upload_max_filesize is the limit of any single file. post_max_size is the limit of the entire body of the request, which could include multiple files. Given post_max_size = 20M and upload_max_filesize = 6M you could upload up to 3 files of 6M each.
The default PHP values are 2 MB for upload_max_filesize, and 8 MB for post_max_size.
You are correct. post_max_size
is the maximum size for all POST body data. It doesn't matter if you're POSTing JSON or your DVD collection, this is all POST body data. Your file upload counts towards this limit. You should also be aware that if you are uploading multiple files, the total file size has to fit within this limit.
upload_max_filesize
is a maximum size only for files that are POSTed. Other types of POST body data are not subject to this limit.
In short, if you want to upload large files, you must increase both limits.
post_max_size is like the superset. upload_max_filesize is in context with file uploads but post_max_size is checked for all kind of POST data. It can be a very big content which can be posted which is limited by post_max_size. So for a big file you want to upload, you need to change both the limits.
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