2

I'm trying to upload some files to an ftp server from an ASP.NET page. Everything is ready however I would like to use an open file dialog to select the files I want to upload. How can I enable file upload to select multiple files, and if I can't, can I simply use the OpenFileDialog like a normal windows forms application ?

Thanks in advance

Jonny
  • 2,787
  • 10
  • 40
  • 62

6 Answers6

2

The issue is that in the context of a web application, you post data as a KeyValuePair. So a single <input type="file" name="Something" /> element can contain only one file because it is only one key.

An OpenFileDialog would be executed server side in a window there; the client would never see it.

Your options are to either limit to 1 file (and have a button to add another file upload), or move to a gmail like approach where you use a flash / plugin to get that functionality.

Tejs
  • 40,736
  • 10
  • 68
  • 86
2

The standard HTML browse dialogue won't let you. However, there's a video on the official ASP.NET site called Multiple File Uploads in ASP.NET 2 that you should look at. There's some code based on that here.

Generally you would either use a Flash or JavaScript/AJAX based solution. There are plenty of controls available that can do this eg.

Just google 'multiple file upload' for far more.

Dan Diplo
  • 25,076
  • 4
  • 67
  • 89
0

i also research on this point but there is no a way to select a multiple file at one file control beacuuse the limitation of the file controll is select only one file at the time so you will take multiple file control for import multiple file

0

Set OpenFileDialog's MultiSelect property to true.

Chris Trombley
  • 2,232
  • 1
  • 17
  • 24
0

Have a look here on how to upload multiple files. You have multiple FileUpload controls and use HttpFileCollection to get the files.

http://www.dotnetcurry.com/ShowArticle.aspx?ID=68&AspxAutoDetectCookieSupport=1

manojlds
  • 290,304
  • 63
  • 469
  • 417
0

You may want to look at these SO posts:

How to select multiple files for upload?

Selecting Multiple Files for Upload in Web Page

Community
  • 1
  • 1
deostroll
  • 11,661
  • 21
  • 90
  • 161