uploads with max_entries: 1 does not seem to auto upload every twice #2271
Closed
Description
Environment
- Elixir version (elixir -v): 1.13.4
- Phoenix version (mix deps): 1.6.12
- Phoenix LiveView version (mix deps): 0.18.1
- Operating system: Windows
- Browsers you attempted to reproduce this bug on (the more the merrier): Chrome
- Does the problem persist after removing "assets/node_modules" and trying again? Yes/no: Yes
Actual behavior
I tried allow_upload/3
with max_entries: 1, auto_upload: true
but auto upload seems to be not working every two times(2,4,6,...).
With my heex code below, progress bar will move and complete soon in the first try.
When I upload the second file, which should replace the former file, the progress bar stays 0.
If I try uploading again, progress bar will move soon, but if I try another time, it doesn't move again.
The progress bar moves when I submit the form, so I'm guessing it is something about auto uploading.
<form id="upload-form" phx-submit="save" phx-change="validate">
<%= for entry <- @uploads.file.entries do %>
<.live_img_preview entry={entry} />
<progress value={entry.progress} max="100">
<%= entry.progress %>%
</progress>
<% end %>
<.live_file_input upload={@uploads.file} />
<button type="submit">Upload</button>
</form>
Expected behavior
The progress bar should move and soon complete as the file is uploaded for the second time.