Nova needs better error handling when file uploads fail #5884
Replies: 5 comments
-
You can use https://github.com/laravel/framework/blob/10.x/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php |
Beta Was this translation helpful? Give feedback.
-
Can you share an example of how this would work with Nova? Are you referring to a rule like this? Also, what about Case 2, which looks like a bug? |
Beta Was this translation helpful? Give feedback.
-
You can read about middleware using https://laravel.com/docs/10.x/middleware#main-content Also, |
Beta Was this translation helpful? Give feedback.
-
Has anyone figured out the cause or a fix for case 2 as described in the original thread? We've been experiencing this and our clients are becoming confused as to when files are actually uploaded. |
Beta Was this translation helpful? Give feedback.
-
Released with Laravel Nova 5.0.0 Feel free to open up a new issue if you're still experiencing this problem on the latest version. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Description:
Related to the issue described here #5880
Although the original issue (of failing file uploads) was resolved due to max allowable file sizes by PHP / Nginx, Nova needs to handle errors more gracefully.
When file uploads dont work (say, because the max PHP file size limit and/or the max file size specified by Nginx or Herd is exceeded), Nova doesn't seem to know of / handle errors very gracefully. Sometimes, it thinks that the file was uploaded and the resource was created, even though neither of those happened. At other times, it displays a server error.
Screenshots of all scenarios can be found below.
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:
Set a low value for
upload_max_filesize
andpost_max_size
in your php.ini file:/Users/connecteev/Library/Application Support/Herd/config/php/{74,80,81,82,83}/php.ini: Added to all php.ini files:
Set a low value for
client_max_body_size
in your nginx.conf and/or herd.conf file:/Users/connecteev/Library/Application Support/Herd/config/nginx/nginx.conf:
client_max_body_size 1M;
/Users/connecteev/Library/Application Support/Herd/config/nginx/herd.conf:
client_max_body_size 1M;
Test with files > 1MB at 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/
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:
Beta Was this translation helpful? Give feedback.
All reactions