前台代码:
1 <form id="form1" method="post" enctype="multipart/form-data" action="d.aspx"> 2 <input id="File1" type="file" name="File1"/> 3 <input id="Submit1" type="submit" value="submit" /> 4 </form>
后台代码:
1 if (Request.Files.Count>0) 2 { 3 HttpPostedFile f = Request.Files[0]; 4 f.SaveAs(Server.MapPath("002.jpg")); 5 }
注意必须有这个enctype="multipart/form-data"
request.files实现异文件上传(开放式上传),布布扣,bubuko.com
原文:http://www.cnblogs.com/yingshiyu/p/3765162.html