Menu

File slicing and chunked uploading

iza
2012-12-11
2013-01-24
  • Shawn Quinn

    Shawn Quinn - 2012-12-12

    Great question. I'd read about that as well, and had been pondering ways to add that capability to GWT Uploader. On a related note I'd thought I read somewhere that you could use this technique to send multiple pieces of the file to the server in parallel, which could potentially speed up the entire upload process by utilizing concurrent XMLHttpRequest's.

    Of course, both those ideas then make the server side piece more complicated since the file has to be reassembled. Any proposals about how a developer would like to see this exposed on the GWT Uploader API so they'd then know how to deal with things on the server side? E.g. should we just expose a "setChunkSize()" method that could be used to enable slicing, or would more be needed to make the reassembly more straightforward on the server side?

     

    Last edit: Shawn Quinn 2012-12-12
  • iza

    iza - 2013-01-24

    I've been massaging GWT Uploader to meet my needs over the last few weeks and wanted to share the changes I've made.

    I've added options for chunkSize, parallelChunks, and chunkStartPostName. On our server, we look at the param chunkStartPostName = (number of bytes from the start of the file), in order to reconstruct the file in proper order (it can infer the chunk size from the size of the data). I've also added a fallback to basic single-file form-based uploading for when flash and html5 are unavailable.

    Some of the code is a little messier than yours but hopefully it will be of some use.

    The complete list of changes I've made are:
    - implement startAjaxUpload(fileId)
    - always register all handlers on swfUpload (so that they can be set or changed after load)
    - fallback to a basic form-based upload if both html5 and flash are unavailable
    - implement chunked parallel uploading with ajax

    I've been keeping an eye on this fork of SWFUpload: https://github.com/danielfbento/SWFUpload
    which claims to support multipart chunked uploading (not in parallel), but I could not get it working.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.