Page 1 of 1

Drag files from the desktop

Posted: Tue May 16, 2006 10:05 am
by lewindha
Hello all

Quick question. I'm developing a content management system for my company. I was wondering if it is possible to drag files from the desktop into a listbox or some other html control to upload the files.

I'm pretty sure this is impossible, but I wanted to ask just in case.

Re: Drag files from the desktop

Posted: Tue May 16, 2006 8:02 pm
by RobertGonzalez
lewindha wrote:I'm pretty sure this is impossible, but I wanted to ask just in case.
I think you are right when you say it is impossible. I'm not sure even AJAX would be able to help here.

Posted: Tue May 16, 2006 8:17 pm
by Burrito
it can't be done with standard html.

you might be able to write an activeX control or a java applet that would allow you to do it...but I've never seen one.

Posted: Tue May 16, 2006 9:32 pm
by alex.barylski
I'm oging to say...it's possible...however not cross browser friendly or portable...but possible

ActiveX...in which case your bound to Windows...I'm sure there are port projects...but none are likley to offer support really required by ActiveX/COM...as thats a monumental task...

Anyways:

http://www.sitescripts.com/ASP/File_Man ... pload.html

Best that I could find...but it's an ActiveX control...

That activeX control likley requires your user to use the ActiveX control interface to upload files...in which case you likley have to initialize it with your FTP credentials...

Which is a security risk...especially if it's initialized in javascript...this is a guess, but I'd look into it...ask how the control knows how to upload...and to where...

Likley you want your users to drag and drop without authenticating...or even know your using such a control altogather...

If memory serves me correctly...Internet Explorer included a COM object called FSO which basically let you manipulate/read a clients file structure...obviously...if my memory does serve me correctly...Windows will warn your users about what is going to happen...as it's a security risk...

With FSO you should be able to scan a local HDD for files using javascript...and if you can indeed open and read files there are techniques you could use to upload multiple files at once...like a drag and drop...

This is just an idea...what I once considered doing in a previous situation many moons ago...not sure if there are other limitations like FORM length limitations on IE, etc...all i'm sure can be circumvented with enough homework ;)

Anyways, using FSO you read the files contents and create a HIDDEN form element and set it's content to that of the FSO read operation.

When you submit a form, along with it goes all the files details or just content depends on how you format HIDDEN fields...

Basically, at a minimum, when you read the file via FSO...you should store it's name/path and contents in each HIDDEN field thus they can be re-created at FORM submittion on the server side :)

Here is a simple tutorial on FSO: http://www.codeproject.com/jscript/search_in_files.asp

But thats your choice...

This solution isn't perfect but with enough AJAX-ing and FSO-ing you *could* implement a complete drag and drop upload system...

I have one cross platform, cross browser solution up my sleeve...but a magician doesn't expose all of his secrets... ;)

Muahahahahahaha :twisted:

BTW: Here is another article that might be of interest: http://www.15seconds.com/issue/010522.htm
http://www.tutorial-web.com/asp/fso/index.asp

HTH

p.s-It just occured to me...Flash is likely an ActiveX control...annnnd you can view Flash in FF...so maybe it is possible on any platform or at least a browser oterh than IE :P

Cheers :)

Posted: Mon May 22, 2006 1:28 pm
by lewindha
Thanks for all of the help.

I figured if it could happen, it'd be some sort of ActiveX control or I would have to use the ftp functions. I'm gonna look into the flash thing, but more likely gonna tell the boss it's too risky right now.