[whatwg] Make the files attribute of the input element writable
costan at gmail.com
Wed Dec 5 05:31:27 PST 2012
There was a thread on this mailing list discussing making it possible to
set the file data behind an <input type="file"> element.
The thread seems to have died down due to insufficient applications for the
proposal. I would like to urge you to reconsider the proposal, and bring up
a few arguments for it.
seamlessly scan the current page for <input type="file"> and add
integration with Dropbox / Google Drive / Sky Drive etc. I claim that
changing the <input> value is the easiest and most robust method of
achieving this without requiring changes to the main application code.
Asides from providing an easy path for developers to integrate online
storage services into their apps, this change would make it easy to write
bookmarklets / browser extensions that add this functionality to any Web
2) If I can set the files attribute of an <input type="file">, I can write
unit tests for any code that deals with such an <input>, such as XHR
uploads. Tested code is less likely to break down as it is maintained, so
it makes for a better Web.
3) Browser extensions / bookmarklets could easily filter files being
uploaded. For example, an extension could automatically resize pictures
larger than a certain threshold by rendering them to an off-screen
<canvas>. As another example, an extension could detect when huge files are
uploaded to a Web mail client or forum, automatically upload them to
Dropbox / Google Drive / Sky Drive, and replace them in the <input
type="file"> with tiny ".url" files pointing to the real files.
With these applications in mind, I don't think FileList needs to accept
Blobs. Instead, there should be an easy way to build a File out of a Blob
and a file name. This capability seems to have been lost when BlobBuilder
was deprecated by the Blob constructor.
I think sticking to files that can be created out of Blobs would allow the
reuse of the current default UI for <input type="file"> with few changes.
Thank you for your consideration,
Victor Costan | victor at costan.us | www.costan.us | +1 (646) 434-8887
Massachusetts Institute of Technology
Department of Electrical Engineering and Computer Science, B.S. '07, M.Eng
'08, Ph.D. '14
Sloan School of Management, B.S. '07
More information about the whatwg