Closed logandk closed 2 weeks ago
This is expected behavior as we cannot easily recover file inputs because the browser holds a private reference to the selected file. We could probably make non-auto uploaded or non-in-progress-subitted recovery work for selected files, but it would be rather limited. Thanks!
That makes total sense. Thanks for the explanation and the huge effort you're putting into Phoenix!
Environment
Actual behavior
After selecting a file to upload using a
live_file_input
, if the websocket connection is disconnected and reconnected again, the file input will be cleared.The issue may be reproduced using the example from https://github.com/wojtekmach/mix_install_examples/blob/main/phoenix_live_view_upload_image.exs
I have updated the example Mix install script to use the most recent versions of all dependencies:
The file is run using the latest Elixir docker image:
docker run -it --rm --name elixir-inst1 -v "$PWD":/usr/src/myapp -w /usr/src/myapp -p 5001:5001 elixir:1.17.1 elixir phoenix_live_view_upload_image.exs
Once the app is accepting connections, I follow these steps to reproduce:
liveSocket.disconnect()
followed byliveSocket.connect()
Expected behavior
The file that was selected for upload should be persisted across websocket reconnects.