View Full Version : DD: Drop from filesystem?

14 Aug 2008, 10:04 AM
Does the DragDrop mechanism allow me to construct a file uploader that receives its input from a drop on the browser window?

E.g., I want to upload/import a file by dragging it from Windows and dropping it on various places in my 1-page site.

Has someone done this already? Or does it "just work"?


16 Aug 2008, 7:14 AM
Well, from skimming about in the Rhino book, it appears that accepting files dropped onto the browser is a "security violation", as is specifying their paths for upload. Using a frameset to read the contents of the drop-loaded file is also a No-No. Gah.

There are plugins for Firefox that enable it [http://static.drop.io/howto/dragdrop/index.html, https://addons.mozilla.org/en-US/firefox/addon/2190] and I'm sure it'd be simple (http://www.15seconds.com/issue/040331.htm) to add the same thing to IE. In a corporate intranet, it wouldn't be all THAT hard to require installation of the plugins as prerequisite to the use of the app.

OTOH, one hack I considered was trapping the unload event, hope to grab the destination url (which would be a file://) and save it in a quick ajax call. Then, when the user is finished "previewing" the data (fancy BS for "you have to press the back button"), they press the back button and the file URL is there for them to copy into the upload dialog. ugh. Is that even worth it? Not even close!

Oh, by the way, thanks for all the replies. :))


17 Aug 2008, 11:42 AM

i just saw your post. Im trying to do exactly the same thing. I want to be able to drag and drop files or folders from the windows explorer to internet explorer (and fox) and make a tree panel accept the drag. The intention is on adding this feature to an existing content management system in a corporate intranet.

Maybe we can sort this out together, it seems to be a useful feature.

I read your post, and i think a solution not requiring add ons would be best. Concerning violation when dragging: i tried to drag pictures into IE, it works. The address bar captures the path and displays the pic.

Maybe it is possible to get javascript to listen to the drop event on the ENTIRE browser window, or an individual extjs panel. Maybe javascript can somehow deactivate the browser for the time of the drop event.

The firefox plugin dragdropupload does a re- configuration of the browser and makes it possible for a javascript program to listen to the drop event: see here


the modification the plugin does to the browser must be possible from WITHIN the script. And also for IE.

Thats my ideas so far, will follow them up tomorrow.

18 Aug 2008, 7:33 AM
Well, kfa, I was going to walk away but if you're game, I'll stick around and see what we can come up with. :-)

I've never been much of a "that's impossible" guy - heck, 2 years ago, I'd bet most people would have said Ext itself was "impossible". So, I will continue banging on the wall in hopes it cracks before my head does. That being said, I'd also bet the person who wrote dragdropupload probably would not have done so if it could be done without it...

I'm looking at the WebKit code for clues today. Keep posting with your progress too!


18 Aug 2008, 7:57 AM
If youre willing to get that involved with adding plugins and such, you should consider Adobe Air, as it can accept drag and drop events from other applications.
If there was an easy way to do this without plugins or modifying the browser, then it would be something that any website could do and would be considered a security risk.

18 Aug 2008, 8:19 AM


18 Aug 2008, 9:01 AM
Interesting stuff. Now if only it actually worked...

18 Aug 2008, 9:57 AM
it worked for me ;)

18 Aug 2008, 11:15 AM
meh the installer went all screwy. VC++ 2005 ftl ;)
I probably need to reboot or something, but i dont feel like it right now.

18 Aug 2008, 11:27 AM
Ah... makes sense.. I didn't run into that - i'm on a mac

[/smirk] ;)

19 Aug 2008, 11:59 PM
well, the yahoo plugin isnt ready yet, as i understand after reading their website, althought its promising.

AIR on the other hand would nicely solve some problems, as it has its own window. But instead of using air, i would probably go with a real Client, on C# or sth. It would be more powerful and could do the same i guess.

20 Aug 2008, 9:18 AM
Thanks - the API looks clean, and it seems not to be too much of an end-user burden given the features it enables. As soon as it's out of the sandbox, I'll take another look.


PS: Isn't it amazing how much time and energy can be spent on such a small thing? I mean, in the scheme of things, being able to drop a file instead of navigating to it is pretty darn insignificant...

20 Aug 2008, 9:21 AM
PS: Isn't it amazing how much time and energy can be spent on such a small thing? I mean, in the scheme of things, being able to drop a file instead of navigating to it is pretty darn insignificant...

Eh, not from a security perspective :)

20 Aug 2008, 10:48 PM
i think it's not so insignificant, even when leaving violations aside. If the user has some files, mostly he will look for them in explorer first. Then he thinks about uploading them. This means he starts the web interface and has to re-navigate there again. I personally find all this clicking very annoying.



i would actuually prefer google desktop search to be integrated in the upload fields of gmail, so i just type name or content of a file, and it will suggest some options.