Home >Backend Development >PHP Tutorial >Why Does My File Upload Fail Even Though `upload_max_filesize` is Higher Than My File Size?
PHP: post_max_size Overrides upload_max_filesize
In a recent inquiry, a user encountered a perplexing issue where the post_max_size setting seemed to limit the size of file uploads, even though upload_max_filesize was set higher.
Question:
Given the following PHP.ini settings:
post_max_size = 8Mb upload_max_filesize = 16Mb
Why is the user unable to upload a 16Mb file via a POST method?
Answer:
The key distinction to understand is that upload_max_filesize limits the size of individual files within a request, while post_max_size limits the total size of the entire HTTP request body, including any POST data and uploaded files.
In this scenario, when the user attempts to upload a 16Mb file:
To accommodate larger file uploads, the user has several options:
The above is the detailed content of Why Does My File Upload Fail Even Though `upload_max_filesize` is Higher Than My File Size?. For more information, please follow other related articles on the PHP Chinese website!