Sometimes, you can face an issue by uploading files with the script and get the error below:
Gateway Timeout.
or
500 Internal Server Error.
or
Batch file upload failed Internal Server Error.
or
Allowed memory size of x bytes exhausted
or
With the "Single Step Form" you will receive the error message: The pictures.X failed to upload.
If you facing the issue above, as well as the file size limit, there is also a memory limit to consider. Several variables (from your php.ini file) need consideration…
max_execution_time =
memory_limit =
post_max_size =
upload_max_filesize =
max_input_time =This configuration can allow you to upload 17MB file
max_execution_time = 120
memory_limit = 512M
post_max_size = 128M
upload_max_filesize = 64M
max_input_time = 240Done.
If the solution above doesn't solve the issue (that is very rare), you need to consider the settings below:
Nginx Settings
Even without knowing how to configure it, you need to care about one setting in nginx.conf file: client_max_body_size. Here’s the official documentation.
As you can read, default value is only 1m, which means that your whole POST request may be maximum 1MB. So you need to change that setting to 20m or higher.
Apache Settings
If you’re using Apache web-server, there’s also a setting for that called LimitRequestBody. Here’s the official documentation. The difference here is that Apache doesn’t give any restrictions by default. So there’s a chance that you will never need to edit this value, but just in case, it’s good to know it exists.