ASP.net - Multiple Upload with jQuery Multiple File Upload Plugin

Ronnie Overby picture Ronnie Overby · Feb 18, 2009 · Viewed 37.8k times · Source

I know how to upload with ASP.net's FileUpload control.

What I want to do is use this jQuery Multiple File Upload Plugin to upload multiple files.

Here is exactly what it does when multiple files are selected for upload:

<input type="file class="multi MultiFile" id="MultiFile1_F3" name="file1[]" style="position: absolute; top: -3000px;">

But I cannot figure out how to manipulate these files from asp.net. I have tried using Request.Files as the following link instructs: ASP.Net Upload of multiple files after choosing them from jQuery

That doesn't work. I think that only works for controls marked with runat="server" at compile time.

Does anyone know how to do this? Maybe something in Request.Form...?

Thanks for your help!

Answer

Chris Hynes picture Chris Hynes · Feb 20, 2009

Two things to check:

  • Make sure your form has the enctype="multipart/form-data" attribute set. This is required to enable uploads.
  • Make sure all file inputs have both id and name attributes set. For some reason, if you don't set both, wierd things happen.

Also, runat="server" shouldn't have anything to do with whether Request.Files works or not -- this is more an issue of the browser actually posting the files.