Question

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
Was it helpful?

Solution

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top