miniserve icon indicating copy to clipboard operation
miniserve copied to clipboard

Uploading progress

Open AlexanderPavlenko opened this issue 3 years ago • 3 comments

It would be nice to have some feedback during uploading large files. Currently it seems the only feedback is a reset of the selected files field when uploading finished.

AlexanderPavlenko avatar Jul 25 '21 12:07 AlexanderPavlenko

I agree!

I wouldn't mind throwing together a PR if the people in charge of the project approve of adding it.

almielczarek avatar Jul 26 '21 19:07 almielczarek

I'd approve it. I think this would be a neat feature to have.

svenstaro avatar Sep 04 '21 23:09 svenstaro

This would also open the door for resuming uploads after network hiccups, since both are accomplished by using JavaScript to do the upload... hopefully as progressive enhancement so the basic functionality remains with JS disabled.

Heck, there's a lot of nice stuff you can get out of progressively enhancing the upload feature.

As an example of how far you can go with it, TransloadIt built a nifty MIT-licensed modular upload widget called Uppy.

Not only does it offer three different choices of progress-indication UI as first-party plugins (@uppy/dashboard, @uppy/status-bar, @uppy/progress-bar), two of which provide ready-made Cancel buttons, it also does:

  • "Resumable file uploads via the open tus standard, so large uploads survive network hiccups"
  • Batch/multi-file upload
  • Pluggable data sources, with "File from disk", "Audio", "Webcam", and "Screencast" all being plugins that can be mixed and matched... though the latter two must be served over HTTPS to work.
  • A drag-and-drop support plugin (either on its own or as part of one of the fancier UIs)
  • Client-side crop/rotate/zoom/flip of images before uploading (@uppy/image-editor)
  • Using IndexedDB for small files and service workers for large files to resume after an accidental tab close/navigate or browser crash (@uppy/golden-retriever)

...and, aside from the resumption option needing a tus implementation on the server side (basically, setting and honoring the right HTTP headers and methods. not difficult.) because they didn't implement chunked-upload-with-retry in the XHR backend, all that is purely client-side, <script>-compatible, one-css-and-one-js-file-bundle-able code as far as I can tell. (The docs only have the "requires server-side helper" badge on the plugins intended to work similarly to indirect/server-to-server FTP by allowing users on metered and/or slow Internet to have the server fetch directly from URLs and accounts on cloud services like Dropbox.) ...so it's an excellent example of a viable fancying up.

...and yes, if I had time to take on another project, I definitely would contribute progress indication and network hiccup recovery. It's the main thing that's inconvenient when I'm using miniserve to let non-technical friends send me files without having to bother with a cloud service.

(Speaking of which, please consider providing progress indication of some sort on the command-line too... even if it's just a log message that says "upload completed: [path]" or "upload failed: [path]". As-is, I just have to hit F5 and watch to see if one of the file sizes is still changing, then use something like unzip -t once it stops to check for truncation.)

ssokolow avatar May 04 '22 15:05 ssokolow