Sae*_*med 4 collections asp.net-mvc file-upload model-binding
我有一些文件在Request.Files对象中具有相同的键,当我使用此代码Request.Files.Keys ["keyName"]时,它只返回一个文件,但我有多个文件与该键.我该怎么办?!顺便说一句,我不能使用键名作为参数,因为我不知道究竟是什么键,也许模型绑定器可以帮助在这种情况下,但我不知道如何将它用于文件.谢谢
你试试这个:
for (int i = 0; i < Request.Files.Count; i++)
{
if (Request.Files.GetKey(i) == "keyName")
{
HttpPostedFileBase fileUpload = Request.Files.Get(i);
}
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2376 次 |
最近记录: |