Uploading multiple files whose INPUT field have the same name

M

Moskie

I have a form where the user is able to provide an arbitrary number of
attachments. This is done through Javascript that dynamically generates
INPUT fields, each of which has the NAME attribute set to the same
value.

Now on the server side processing of this form, how do I handle these
posted files, each of which has the same name? I was expecting the
Request.Files collection to behave similarly to the Request.Form
collection, in that if there are multiple files that have the same name
(say, "MyUploadedFile"), then Request.Files("MyUploadedFile") would,
itself, return an array of files.

But it doesn't appear to work that way. Is it possible to process this
form properly?

I also had the idea of looping through the Request.Files collection,
then checking if the INPUT name of the file is "MyUploadedFile", and
going from there. (I need to check the input name, since there are
other files uploaded elsewhere on the form with different names) But I
don't see how to access the INPUT name of a particular posted file...
is there a way to do that?

Any help would be appreciated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,054
Latest member
LucyCarper

Latest Threads

Top