FriendsOfFlarum / upload

The file upload extension with insane intelligence for your Flarum forum.
https://discuss.flarum.org/d/4154
MIT License
177 stars 96 forks source link

Descriptive Error when upload fails #141

Closed mikejones3 closed 1 year ago

mikejones3 commented 6 years ago

It would be nice for the users if an upload fails due to the size of the image, that they are told the image was too large and we only accept blah blah blah sized images.

Right now it just says oops something went wrong.

clarkwinkelmann commented 6 years ago

Are you sure debug mode is off on your forum ?

When debug mode is on, all validation exceptions show as an error with ValidationException debug name. With debug mode disabled, those exceptions are shown as user-friendly texts.

mikejones3 commented 6 years ago

Pretty sure its off because I get a user friendly text pop up that says oops something went wrong. I will post a screenshot later when I get back to my laptop

clarkwinkelmann commented 6 years ago

Okay I did a few tests. If your image is above Flagrow Upload config but within php.ini allowed size you get this:

image

But if you exceed php.ini allowed size you get this

image

I suppose you're subject to option 2 above ?

If there's a PHP exception, we should be able to catch it and return a more friendly message. Maybe @luceos will be able to identify where to do this check more quickly than I.

Thanks for report, that's definitely something we should fix.

mikejones3 commented 6 years ago

Awesome, in the meantime, I need to edit my php.ini file. Do you know where I can find that on a nginx ubuntu server?

luceos commented 6 years ago

@mikejones3 /etc/php/fpm/php.ini but that might defer. You can create a phpinfo file on your website to see which php.ini fpm uses.