Closed connecteev closed 1 year ago
What's the configured max_post_size
set on PHP?
@crynobone thanks..I am now able to upload a max file size of 350MB, using these changes:
/Users/connecteev/Library/Application Support/Herd/config/php/{74,80,81,82,83}/php.ini: Added to all php.ini files:
upload_max_filesize=1G
post_max_size=1G
/Users/connecteev/Library/Application Support/Herd/config/nginx/nginx.conf: Changed client_max_body_size 512M;
to client_max_body_size 1G;
/Users/connecteev/Library/Application Support/Herd/config/nginx/herd.conf: Changed client_max_body_size 128M;
to client_max_body_size 1G;
Then restarted Herd (php and nginx).
I can now upload a 350MB file, though 600MB-950MB uploads still fail. There is nothing in the laravel error log, and this is the error coming from Nginx now:
2023/09/11 17:48:44 [error] 14243#3547640: *179 client intended to send too large body: 939929681 bytes, client: 127.0.0.1, server: inertia.test, request: "POST /nova-api/course-videos?editing=true&editMode=create HTTP/2.0", host: "inertia.test", referrer: "https://inertia.test/admin/resources/course-videos/new"
(Nova relays There was a problem submitting the form.
to the front-end in this block of code:
/vandor/laravel/nova/resources/js/mixins/HandlesFormRequest.js:
handleResponseError(error) {
if (error.response === undefined || error.response.status == 500) {
Nova.error(this.__('There was a problem submitting the form.'))
} else if (error.response.status == 422) {
this.validationErrors = new Errors(error.response.data.errors)
Nova.error(this.__('There was a problem submitting the form.'))
} else {
Nova.error(
this.__('There was a problem submitting the form.') +
' "' +
error.response.statusText +
'"'
)
}
},
So, while I still want to raise the limit to be able to upload ~1GB files and haven't been able to figure out how to do that, closing this as it is not a Nova issue but an Nginx / PHP issue.
From more digging:
https://www.nginx.com/resources/wiki/modules/upload/#upload-max-file-size
For “hard” limit client_max_body_size directive must be used. The value of zero for this directive specifies that no restrictions on file size should be applied.
Interestingly, I tried setting client_max_body_size 0 in both the nginx.conf and herd.conf, but that didnt change anything. Still cant seem to upload beyond 350MB files, and I wonder why nginx doesn't like that. Very strange.
@crynobone just realized one thing - it would be nice if Nova handled the errors like this more elegantly. Lmk if you'd like to reopen this, want a separate ticket, or have some other preference.
Of course, if you have thoughts on how to upload larger files, that would be helpful also.
Description:
I am having a very frustrating time with Nova File uploads. Most file uploads dont work consistently. Nova doesn't seem to know of / handle errors very gracefully, and file uploads don't seem to work that well. This is despite me perusing / trying everything I could find in the File documentation.
I have tested with https://file-examples.com/index.php/sample-video-files/sample-mov-files-download/ and https://file-examples.com/index.php/sample-video-files/sample-mp4-files/ So far, I have only managed to get specific files to work:
Detailed steps to reproduce the issue on a fresh Nova installation:
Create a CourseVideo Nova resource with the following
File
field type to accept file / video uploadscourse_videos migration file:
Now, go to the Nova admin and try to upload a new video, in my case: /admin/resources/course-videos/new On submitting the form (in my case pressing the "Create Course Video" button), you either see:
Case 1 (File upload works successfully):
Case 2 (File upload fails, but Nova thinks it worked):
Case 3 (File upload fails, Nova gives an error message):
In both case 2 and 3, this is what you see a similar error in the laravel.log server logs:
So, it looks like 1.4MB MOV and MP4 files work, but 2MB+ files don't. It has to be an issue with my server settings (Nginx, Apache, etc), right? I looked at the responses at https://github.com/laravel/nova-issues/issues/2527 and https://github.com/laravel/nova-issues/issues/1998 and checked my server settings. They seem fine. Here are snippets from my settings for Nginx and Laravel Herd. It looks like nginx.conf includes herd.conf. The values for
client_max_body_size
are 512M and 128M respectively.What is going on? This has me stumped, and I wish Nova handled these essentials more gracefully.
nginx.conf:
herd.conf