leptos-use icon indicating copy to clipboard operation
leptos-use copied to clipboard

upload file with status feedback

Open johansmitsnl opened this issue 1 year ago • 1 comments

Uploading files on a client side application is often used. It would be nice to have a helper that provides details on the upload to show progress and state.

The function should accept:

  • url
  • method (POST/PUT/...).

The signals it could return are:

  • State (waiting, uploading(x bytes, total bytes), done)
  • Trigger/Start the upload, you may want to queue the upload
  • Cancel/abort the upload
  • Optional callback with the state where you want to manage some other state when the state changes

johansmitsnl avatar Nov 06 '24 14:11 johansmitsnl

@johansmitsnl

After doing a bit of research I think this function could take an arbitrary FormData as input to upload. That way a user could easily upload one or multiple files together with extra data, or even just data without files.

The FormData could be a wrapper around web_sys::FormData to allow for better UX with rust types like byte arrays etc.

What do you think?

maccesch avatar Dec 05 '24 18:12 maccesch