views:

876

answers:

4

I have a web page where i have an ASP.NET file upload control to upload files from client machine to Server.Now i want to do the uploading n number of times.Ex : I want to upload 100 files from my local pc to server.The 100 file names i can read from an excel file in my program.But is there any way to assign this file to the file upload control ?

+1  A: 

No, as a security feature, FilUpload controls do not allow you to set what to download (imagine if you sign on to a website, and it is set to upload a passwords file or something).

Now there is probably another control, or a way to code around this, buut the FileUpload control will not allow it.

I would recommend using the jQuery Multifile Uploader which would take care of a UI (if you need one). And the actual uploads with Free ASP Uploads which takes care of the actual file transfer. Though it sounds like you are tkaing care of the programs programatically, so you can skip the multifule and just work with free asp upload.

naspinski
Then how can i upload multiple files from my pc to server
Shyju
added in how to get around this ^^^
naspinski
+1  A: 

You'll have to make your own Flash object or something to accomplish this, the basic HTML/ASP.Net controls won't let you do what you're looking for.

Nicholas H
+1  A: 

This will require creating some kind of an active or installable control. In order to get around the security hole of doing this, you're ultimately going to have to be able to execute code on the machine to select and upload the file.

And at that point, you're platform specific, so...

I would strongly suggest that instead of trying to have a web site automatically upload files for you, that you make a WinForms utility to accomplish this task and upload the files wherever you need, communicate with the web site over web services, etc.

routeNpingme
+1  A: 

This is a security restriction, you cant script the file selection of an upload box as it would allow hackers to write scripts to steal files off your computer.

You could use this silverlight upload utility which is my list of "things to use when I get the chance".

It has a nice UI and supports uploading many files at once. I originally tracked it down doing some research for a photography website that we were quoting for but that project fell through.

Anyway the project can be found here:

It also has full source code included so even if the control's developers abandon it you still have the choice to edit it yourself.

rtpHarry