I have some files with the same keys in Request.Files object and when I use this code Request.Files.Keys["keyName"] it returns just one file but I have more than one file with that key. what should I do?! By the way I can't use key names as argument because I don't know what key exactly is, maybe model binder can help in this case but I don't know how can I use it for Files. Thanks
Asked
Active
Viewed 4,063 times
5
-
Take a look at this http://stackoverflow.com/questions/1760510/foreach-on-request-files – WannaCSharp Nov 02 '13 at 09:31
1 Answers
10
you try this:
for (int i = 0; i < Request.Files.Count; i++)
{
if (Request.Files.GetKey(i) == "keyName")
{
HttpPostedFileBase fileUpload = Request.Files.Get(i);
}
}

Elena
- 125
- 1
- 9