Open Multiselect Open dialog box 
Author Message
 Open Multiselect Open dialog box

Hello,

I are trying to upload 100s of images to my client's server from my development machine.  Because
the images are housed in a database and not in the file system, FTP is out.  However, to keep it
convenient and manageable, I would like to be able to upload the images simultaneously.

To my surprise, I discovered that the InputFile HTML control (i.e. <input type="file">) does not
allow multiple selections.  Because this area of the Web site will be limed to Administrators only,
I thought it wouldn't hurt to use VBScript and COM to gain access to the CommonDialog component.
However, the same code that I would use to open a multiselect FileOpen dialog box in VB doesn't work
in VBScript.  It will only allow single selections.

This is the code I am using:

<html>
 <head>
  <script language="VBScript">
   Dim dlgOpen

   Private Sub btnBrowse_Click()
    Set dlgOpen = CreateObject("MSComDlg.CommonDialog.1")

    If dlgOpen Is Nothing Then
     MsgBox "Error. CommonDialog object could not be created."
     Exit Sub
    End If

    With dlgOpen
     .Filter = "All files (*.*)|*.*|"
     .FilterIndex = 1
     .Flags = cdlOFNAllowMultiselect Or cdlOFNFileMustExist Or cdlOFNExplorer
     .DialogTitle = "Select one or more images"
     .MaxFileSize = 10240
     .FileName = ""
     .CancelError = False
     .ShowOpen
    End With
   End Sub
  </script>
 </head>
 <body>
  <form enctype="multipart/form-data">
   <input type="text" id="txtFiles" size="50"> <input type="button" value="Browse..." id="btnBrowse"
onclick="btnBrowse_Click">
  </form>
 </body>
</html>

Thanks in advance.

Regards,

Travis Spencer
Portland, OR USA



Thu, 02 Sep 2004 16:55:26 GMT  
 Open Multiselect Open dialog box
hi Travis,

Those constants you are using are defined in the msComDlg typelib, but they
don't make their way into your code auto-magically.

You will have to define them EXPLICITLY:

   Const cdlOFNAllowMultiselect = &H200
   Const cdlOFNFileMustExist = &H1000
   Const cdlOFNExplorer = &H80000

cheers, jw


Quote:
> Hello,

> I are trying to upload 100s of images to my client's server from my

development machine.  Because
Quote:
> the images are housed in a database and not in the file system, FTP is

out.  However, to keep it
Quote:
> convenient and manageable, I would like to be able to upload the images
simultaneously.

> To my surprise, I discovered that the InputFile HTML control (i.e. <input

type="file">) does not
Quote:
> allow multiple selections.  Because this area of the Web site will be

limed to Administrators only,
Quote:
> I thought it wouldn't hurt to use VBScript and COM to gain access to the

CommonDialog component.
Quote:
> However, the same code that I would use to open a multiselect FileOpen

dialog box in VB doesn't work
Quote:
> in VBScript.  It will only allow single selections.

> This is the code I am using:

> <html>
>  <head>
>   <script language="VBScript">
>    Dim dlgOpen

>    Private Sub btnBrowse_Click()
>     Set dlgOpen = CreateObject("MSComDlg.CommonDialog.1")

>     If dlgOpen Is Nothing Then
>      MsgBox "Error. CommonDialog object could not be created."
>      Exit Sub
>     End If

>     With dlgOpen
>      .Filter = "All files (*.*)|*.*|"
>      .FilterIndex = 1
>      .Flags = cdlOFNAllowMultiselect Or cdlOFNFileMustExist Or
cdlOFNExplorer
>      .DialogTitle = "Select one or more images"
>      .MaxFileSize = 10240
>      .FileName = ""
>      .CancelError = False
>      .ShowOpen
>     End With
>    End Sub
>   </script>
>  </head>
>  <body>
>   <form enctype="multipart/form-data">
>    <input type="text" id="txtFiles" size="50"> <input type="button"

value="Browse..." id="btnBrowse"

- Show quoted text -

Quote:
> onclick="btnBrowse_Click">
>   </form>
>  </body>
> </html>

> Thanks in advance.

> Regards,

> Travis Spencer
> Portland, OR USA



Sat, 04 Sep 2004 00:42:31 GMT  
 Open Multiselect Open dialog box
I know what your next question is going to be: "OK, I was able to make
multiple selections, but now how do I retrieve those file names?"

For an answer, go to vbNet (Randy Birch): "How to Retrieve Multiple
Filenames from the VB Common Dialog Control", found here:

    http://www.mvps.org/vbnet/faq/main/cdlgmultiselect.htm

cheers, jw


Quote:
> Hello,

> I are trying to upload 100s of images to my client's server from my

development machine.  Because
Quote:
> the images are housed in a database and not in the file system, FTP is

out.  However, to keep it
Quote:
> convenient and manageable, I would like to be able to upload the images
simultaneously.

> To my surprise, I discovered that the InputFile HTML control (i.e. <input

type="file">) does not
Quote:
> allow multiple selections.  Because this area of the Web site will be

limed to Administrators only,
Quote:
> I thought it wouldn't hurt to use VBScript and COM to gain access to the

CommonDialog component.
Quote:
> However, the same code that I would use to open a multiselect FileOpen

dialog box in VB doesn't work
Quote:
> in VBScript.  It will only allow single selections.

> This is the code I am using:

> <html>
>  <head>
>   <script language="VBScript">
>    Dim dlgOpen

>    Private Sub btnBrowse_Click()
>     Set dlgOpen = CreateObject("MSComDlg.CommonDialog.1")

>     If dlgOpen Is Nothing Then
>      MsgBox "Error. CommonDialog object could not be created."
>      Exit Sub
>     End If

>     With dlgOpen
>      .Filter = "All files (*.*)|*.*|"
>      .FilterIndex = 1
>      .Flags = cdlOFNAllowMultiselect Or cdlOFNFileMustExist Or
cdlOFNExplorer
>      .DialogTitle = "Select one or more images"
>      .MaxFileSize = 10240
>      .FileName = ""
>      .CancelError = False
>      .ShowOpen
>     End With
>    End Sub
>   </script>
>  </head>
>  <body>
>   <form enctype="multipart/form-data">
>    <input type="text" id="txtFiles" size="50"> <input type="button"

value="Browse..." id="btnBrowse"

- Show quoted text -

Quote:
> onclick="btnBrowse_Click">
>   </form>
>  </body>
> </html>

> Thanks in advance.

> Regards,

> Travis Spencer
> Portland, OR USA



Sat, 04 Sep 2004 01:44:20 GMT  
 Open Multiselect Open dialog box
Thank you Jim,

I guess that was my own fault for forgetting Option Explicit.  Now if I can fandangle ASP.NET to
upload the images into an Access DB, I will have an extremely simple solution to what has become a
very complex problem.

Regards,

Travis Spencer
Portland, OR USA


Quote:
> hi Travis,

> Those constants you are using are defined in the msComDlg typelib, but they
> don't make their way into your code auto-magically.

> You will have to define them EXPLICITLY:

>    Const cdlOFNAllowMultiselect = &H200
>    Const cdlOFNFileMustExist = &H1000
>    Const cdlOFNExplorer = &H80000

> cheers, jw



> > Hello,

> > I are trying to upload 100s of images to my client's server from my
> development machine.  Because
> > the images are housed in a database and not in the file system, FTP is
> out.  However, to keep it
> > convenient and manageable, I would like to be able to upload the images
> simultaneously.

> > To my surprise, I discovered that the InputFile HTML control (i.e. <input
> type="file">) does not
> > allow multiple selections.  Because this area of the Web site will be
> limed to Administrators only,
> > I thought it wouldn't hurt to use VBScript and COM to gain access to the
> CommonDialog component.
> > However, the same code that I would use to open a multiselect FileOpen
> dialog box in VB doesn't work
> > in VBScript.  It will only allow single selections.

> > This is the code I am using:

> > <html>
> >  <head>
> >   <script language="VBScript">
> >    Dim dlgOpen

> >    Private Sub btnBrowse_Click()
> >     Set dlgOpen = CreateObject("MSComDlg.CommonDialog.1")

> >     If dlgOpen Is Nothing Then
> >      MsgBox "Error. CommonDialog object could not be created."
> >      Exit Sub
> >     End If

> >     With dlgOpen
> >      .Filter = "All files (*.*)|*.*|"
> >      .FilterIndex = 1
> >      .Flags = cdlOFNAllowMultiselect Or cdlOFNFileMustExist Or
> cdlOFNExplorer
> >      .DialogTitle = "Select one or more images"
> >      .MaxFileSize = 10240
> >      .FileName = ""
> >      .CancelError = False
> >      .ShowOpen
> >     End With
> >    End Sub
> >   </script>
> >  </head>
> >  <body>
> >   <form enctype="multipart/form-data">
> >    <input type="text" id="txtFiles" size="50"> <input type="button"
> value="Browse..." id="btnBrowse"
> > onclick="btnBrowse_Click">
> >   </form>
> >  </body>
> > </html>

> > Thanks in advance.

> > Regards,

> > Travis Spencer
> > Portland, OR USA



Sat, 04 Sep 2004 02:47:37 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. How to just open the Open dialog box?

2. Centering a Open Dialog box using the Common dialog

3. Acc97: Specifying /CMD parameter when opening database via open dialog

4. Open a file open dialog in Project

5. Open a Save/Open-dialog

6. opening a browse or file open dialog

7. File Open Dialog box from CmnDlg32.dll?

8. WSH and "Open File" dialog box

9. How to open a GetFilename dialog box

10. Open file dialog box and upload file

11. Bypass Open/Download Dialog Box

12. open common dialog box

 

 
Powered by phpBB® Forum Software