Tuesday, March 26, 2013

Multiple download is still missing in HTML5

Multiple Upload does work and it works great however it comes to my attention multiple download is still not well supported. Some claim that for security reasons it should not be allowed but what is the big deal on leaving the user select a destination directory? How is that less secure than allowing the user select the upload files from any directory? Is it that we are scared of the user allowing to write something bad in their "system" directories? Are we trying to protect the ones who click on any link and by that we are sacrificing the user experience of those that do check they are navigating a safe website before they proceed doing anything else?

So people are still then forced to use Adobe Flash. Is that more secure than allowing multiple downloads natively from HTML5? I believe that with correct controls this can be implemented safely and provide the nice user experience we all are waiting for.

Alternatives? Well,
  1. There is a way to download multiple files (the user will need to accept a browser popup which states something like in chrome "This site is attempting to download multiple files. Do you want to allow this?"). The problem will be that all files will be downloaded to the pre-configured by browser download directory. There is no way for the user or code to *dynamically* select a specific download directory. A demo can be seen in ftp://angiv.vmhost.psu.edu/agselects/framepost/multi/test/manual.html at the time of this writing. The source code is in http://biesiad.github.com/multiDownload/. You can always download it from github and run it locally (this is pure client side code).
  2. We could allow packaging in a zip file all documents and then offer the user a way to select where to download in their local file system. This needs flash though (which we have pushed to eliminate for years, HTML5 heard us and provided the "//input[@type="file"]/@multiple"). The problem with this (besides Flash) is that there is not support to download multiple individual files, the user needs to download a zip file and then uncompress later on. A demo for this can be found in http://pixelgraphics.us/downloadify/test.html. The open source code can be reached at https://github.com/dcneiner/Downloadify.
  3. We could allow drag and drop from the Browser to the file system, a feature Gmail has had now for a while. The problem with this hack (besides having Chrome support only) so far is that it is limited to one file at the time. A demo is available in http://www.thecssninja.com/demo/gmail_dragout/. There are some libraries based on this finding. I leave you google for them.
Hopefully someone will read this and suggest a better approach. Please do include demo/APIs. Happy coding!


DHLee said...

"The problem will be that all files will be downloaded to their pre-configured by browser download directory. There is no way to select a specific download directory" - You just need to go to Chrome settings -> downloads -> Ask where to save each file before downloading

Nestor Urquiza said...

@DHLee I meant to say there is no way to *dynamically* select a specific download directory. I will correct that. Thanks.