leptos-use
leptos-use copied to clipboard
upload file with status feedback
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/Startthe upload, you may want to queue the upload -
Cancel/abortthe upload - Optional
callbackwith the state where you want to manage some other state when the state changes
@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?