kartik-v / bootstrap-fileinput

An enhanced HTML 5 file input for Bootstrap 5.x/4.x./3.x with file preview, multiple selection, and more features.
http://plugins.krajee.com/file-input
Other
5.35k stars 2.4k forks source link

Confusing progressbar behaviour on upload error #1854

Open anesvetaevtrackad opened 5 months ago

anesvetaevtrackad commented 5 months ago

Prerequisites

Steps to reproduce the issue

  1. Create the simpliest bootstrap-fileinput installation (like from docs)
  2. Set dummy uploadUrl to make it work in async mode
  3. Try to "upload" any file

Expected behavior and actual behavior

When I follow these steps, I see flashing error message and then "Done" message in progress bar image

I was expecting that failed upload will result in failed status in the progress bar.

Yes, if the plugin works with preview enabled, then preview icons are showing errors. Also, the frame around file is red, it's good. But progress bar is still green on error.

I find this confusing to users - when the user uploads invalid file, user sees green "Done" progressbar.

Is there any way to show progressbar red with error message, not changing to "Done" right away? Is it expected behaviour or bug?

I've tried to solve it on my website and eventually I found that it is reproduceable with the simpliest config from docs (I can share it if needed).

Thank you and thank you for a great plugin!

Environment

Browsers

Operating System

Libraries

Isolating the problem

kartik-v commented 3 months ago

This should not be the case normally - as the plugin shows the error progress template when error is encountered generally. Can you mention the configuration and your specific use case which can be reproduced (a JS BIN example)?

anesvetaevtrackad commented 2 months ago

@kartik-v Hello, sorry for long answer

Here is a link: https://jsbin.com/woyamicoki/edit?html,js,output

I've taken an example code from docs https://plugins.krajee.com/file-input#usage-step-1 And added some dummy url as uploadUrl setting.

When I upload the file, of course it fails, but the "Done" line is green.

I specially reproduced it like this, because my actual website uses the older version and it's customized, so I've decided to make a simple example, to not go into much details.

P.S. I think there is smth wrong with docs - I needed to replace buffer.min.js and filetype.min.js with unminified versions to get the example working.

image