怎么获取不到上传的文件???``````````
JS部分
function submit_order()
{
document.getElementById("userfile").click();
window.confirm(document.getElementById("userfile").value)
window.location.href="<%=Save()%>";
}
CS部分
private void Page_Load(object sender, System.EventArgs e)
{
Button1.Attributes.Add("onclick","submit_order();");
}
public string Save()
{
HttpFileCollection file =HttpContext.Current.Request.Files;
for(int n = 0;n <file.Count;n++)
{
HttpPostedFile postfile = file[n];
string fileName = Path.GetFileName(postfile.FileName);
string savePath = System.Web.HttpContext.Current.Request.MapPath("d:/")+fileName;
postfile.SaveAs(savePath);
}
return "heihei.aspx";
}
麻烦大家看看```
我获取的文件数总是为0