HttpContext.Current.Request.Files只能取到第一个文件

今天给移动的上传接口,上传多张照片总是只有一张成功,HttpFileCollection files = HttpContext.Current.Request.Files

调试发现取到的照片第一张后面的照片FilelLength=0;

想起以前web端上传类似的问题:

必须为file控件添加Name属性

function newUpload(obj)
{
    if(obj.value=="")
    {
        return;
    }
    else
    {
     var str = '<br/><input type="file" onchange="javascript:newUpload(this);"  runat="server"name="file"  />';
     document.getElementById('Upload1').insertAdjacentHTML("beforeEnd",str);
   }
}

 

然后查看移动端代码发现给的file的name属性只有一个,尝试改成不同的值,果然就成功了。

posted @ 2017-11-03 15:57  Lyfing  阅读(2922)  评论(0编辑  收藏  举报