I believe in principle yes, although I have not tried it yet.
What will be the problem is that XMLHttpRequest#send() accepts a Unicode string and encodes it as UTF-8. This prevents you from sending clean binary files, and most binary files, such as images, will not be valid UTF-8 sequences.
Most likely, you will use the fact that the FileAPI specification calls a “binary string” (bytes are treated as ISO-8859-1, so each charCodeAt corresponds to a byte), encoded in UTF-8. This is about 50% more than just downloading a file. Is it worth a slower download to get a progress report?
(God, if browsers had a better interface to show how the download is going, none of the endless jokes / Flash / Java / ActiveX would be necessary. Come on, sellers of browsers, this is a good big info pop-up window with a progress indicator, which too much to ask for?)
bobince
source share