在HTML页面File上传的文件,怎么在.ASPX页面获取?
--------------------编程问答-------------------- 用Jquery + Ashx可以实现 --------------------编程问答-------------------- form 设置enctype="multipart/form-data"提交事件里
HttpPostedFile file = Request.Files["UserPic"];
操作file就行了 --------------------编程问答-------------------- HttpPostedFile file = Request.Files[0] 就行了。 --------------------编程问答-------------------- 前台:
<body>
<form id="form1" runat="server" enctype="multipart/form-data">
<div>
<input name='upload' id="File1" type="file" />
<input id="Submit1" type="submit" value="submit" />
</div>
</form>
</body>
后台:
if (Request.Files["upload"] != null)
{
//获取网站根目录
//string strPath = HttpContext.Current.Request.PhysicalApplicationPath;
HttpPostedFile file = Context.Request.Files["upload"];
string strName = file.FileName;
file.SaveAs("C:/file/" + strName);
}
补充:.NET技术 , C#