-
You can probably catch this one in the php.ini on server configuration level. Laravel validation only kicks in after the request hits the validation layer, which is after the browser completely (so including the 2GB file) sent the request.
-
Wait, what? Instead of implementing a spinner, I'd have a look why simple tasks like you mention take 30 seconds in the first place. I can't imagine you getting any kind of userbase with performance like that.
File validation before upload
Just ended building a laravel app.
But after making it live on the server, I found some-things which required immediate action.
-
File upload max size is 2mb But if someone tries to upload a file say for eg.: 2Gb or any bigger file, it first gets uploaded, it takes approx 15-20 mins and then shows the error, The image cannot exceed 2mb. So just wanted to know if there's some solution for this, if the file size exceeds 2mb, it should show the error without getting uploaded.
-
There are few tasks which takes about 30 seconds to load like logging-in, registering, creating a new post etc.. So, how can I show something like spinner icon along with text "Please be patient, while we log you in" or something like that.
How did you use the code? I'd use it on the onsubmit event of the form and if the filesize is greater, don't submit the form. Not sure how you're using it...
- user clicks submit
- check filesize
- if filesize > 2m, show error message and preventDefault() on form submission
Please or to participate in this conversation.