How do you implement file drag-and-drop upload in Google Chrome?

Posted by Chris R on Stack Overflow See other posts from Stack Overflow or by Chris R
Published on 2010-05-25T00:26:42Z Indexed on 2010/05/25 0:31 UTC
Read the original article Hit count: 337

Filed under:
|
|
|

I've found several tutorials online about implementing file drag/drop with Firefox 3.6 (they involve using a FileReader object to get the file binary data). However, I cannot create a FileReader object in Chrome on Windows or Mac.

Does anyone know what the API is to read and manipulate data from a drag-and-dropped file in Chrome? If I can get the binary data of the file, I already have the rest of the code to perform the upload.

Note: I've also tried using the getAsBinary() function call on the file object of the drag event (event.dataTransfer.file) but I believe that is a Mozilla-specific function and not implemented in Chrome.

Also, I'm not interested in a solution using google gears or one that requires a user to select files from a dialog. I'm specifically trying to implement a drag-and-drop file upload.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about html