How to resume a broken upload in HTML5

I am trying to add resume functionality to html5 file uploader.

I need to be able to resume after browser was closed (and reopened) and I lost the file object, I do not want the user to drag/open the file again.

Until now I used java applet to do it but I was hoping to find an html5 solution for this problem.

I thought about saving the files in local storage but they are too big.

Is there a way to save only the file object the path or any other information that might help me reopen the file without asking the user to reopen the file?

You might want to try out Resumable.js – JavaScript Library Providing Multiple Simultaneous, Stable And Resumable Uploads Via The HTML5 File API (or its domain

Resumable. js a JavaScript library providing multiple simultaneous, stable and resumable uploads via the HTML5 File API.

The library is designed to introduce fault-tolerance into the upload of large files through HTTP. This is done by splitting each files into small chunks; whenever the upload of a chunk fails, uploading is retried until the procedure completes. This allows uploads to automatically resume uploading after a network connection is lost either locally or to the server. Additionally, it allows for users to pause and resume uploads without loosing state.

Resumable.js relies on the HTML5 File API and the ability to chunks files into smaller pieces. Currently, this means that support is limited to Firefox 4+ and Chrome 11+.

sorry, it is not possible. The link between the file and the browser, that you can access with javascript (the FileURL) is destroyed after closing the window (and for sure, when closing the browser). You could save the name of the file and the amounts/parts uploaded and request the user to upload that file again, continuing from where he left off, but not automatically, without the users consent.

Read More:   how to see phonegap javascript log messages on xcode console

/Edit: Why the negative votes? Please leave a comment so I know what I said wrong! The question is about how to resume an upload when the user closes the browser. And that isn’t possible. It is possible to stop/resume an upload while the Browser remains open and connection is lost, but not when the user closes the browser (references are lost). You could however copy the file to a temporary filesystem and then resume upload from there but that needs user consent and its limited to the amount of space the user provisions you to use.

This is possible with newer browsers(Chrome, Firefox).

The youtube uploader is a good example.

I’m not entirely sure how their implementation fully works, but it is possible.

The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Similar Posts