When sending files larger than 1MB in a POST request I get a (failed)
response in Chrome. Files smaller than 1MB work fine so I expect that something is setting a limit of 1MB.
I am running phpinfo()
to check the values in my php.ini file, which shows that upload_max_filesize=100M
and post_max_size=100M
. I have also checked the Laravel logs but there are no errors regarding this.
I am using Laravel 6.18.13 running on a Homestead box with PHP 7.4.5. My front-end application is using Angular 9. This is the code in Angular that sends the request:
const formData = new FormData();
params.files.forEach((file: File) => {
formData.append(`audio_files[]`, file, file.name);
});
return this.http.post<APIResponse>(url, formData);
Any ideas as to what might be setting this 1MB limit are appreciated.
Most web sites have multiple layers to consider:
For nginx make sure that the client_max_body_size
directive is properly set. Must be set both in http and server context.
(would yield 413 entity too large http status code)
You are correct to adjust the following:
upload_max_filesize
post_max_size
file_uploads
max_file_uploads
Check also your PHP error and access log for more information.
If the data is parsed to the a database, that could have some limits too. For MySQL consider the following:
max_allowed_packet
The browser or JavaScript could cancel the request, please check your console for warnings, make sure you are not sending incorrect headers, the request is cancelled by browser addins or similar.