ya*********@gmail.com wrote:
Hey,
I'm currently trying to find a way to open a dialog box that will allow
me to select more than one file at a time, so if I want to upload
select all the files in a directory, I won't have to have the number of
dialog boxes as files in the directory. I was thinking of using a
ActiveX control, but I don't want to make the sure download additional
components to be able to do this, so is there maybe some sort of
Windows ActiveX control that can do this?
Or maybe any of you guys have any better solution to my problem?
Native FileScriptingObject (IE / Windows) and native XPConnect (Gesko /
anywhere) allow you to access local file system *with all security
checks and possible blocks of course*.
I'm doing my jsFileManager now as a uniformed wrapper over these two
very different and rather buggy technics.
It appeared to be much more time and efforts consuming than I ever
originally thought, and one of issues is directly connected with your
question.
In the particular it appeared that you cannot display standard file
dialog in Windows *because there is no such*. I know it sounds crazy
but it's true. Windows provides basic interface to the file system
(drives and folder collections, attributes etc.) but the actual dialog
window is built by the application itself. If you write a C++/C#
application you can link needed interfaces from the system library and
be happy. But when acting from the script - even WScript.Shell do not
let you such low level access. In Windows XP you can semi-hack the
situation by retreiving MSComDlg.CommonDialog over WScript but this is
not a real dialog: it's a dialog template which is ugly and
disfunctional w/o extras: for example, all folders and files will be
shown with DOS "8.3" names.
And in even in the most favorable case you cannot get multiple
selection dialog because there is no such beast in Windows: you have to
program it from the scratch (alike Java FileChooser). There is another
hack for Windows XP SP1 or higher to make your file choise multiple,
but it is not reliable and its only for this Windows version.
I personally ended up by implementing getDirectory() method which
returns an array with extensive directory info. To build a nice
multi-choice dialog window atop of it will be a pure css/html
challenge.
The above conclusions are based on my testing and reading MSDN. If I'm
wrong and there are other ways, I would like to be pointed at.