1 context.Response.ContentType = "text/plain"; 2 context.Response.Charset = "utf-8"; 3 HttpPostedFile file = context.Request.Files["Filedata"]; 4 int i = file.ContentLength; 5 string uploadPath = 6 HttpContext.Current.Server.MapPath(@context.Request["folder"]) + "\\"; 7 8 if (file != null) 9 {10 if (!Directory.Exists(uploadPath))11 {12 Directory.CreateDirectory(uploadPath);13 } 14 15 file.SaveAs(uploadPath + file.FileName);16 //下面这句代码缺少的话,上传成功后上传队列的显示不会自动消失17 context.Response.Write("1");18 }19 else20 {21 context.Response.Write("0");22 }
我今天用uploadify写文件上传的功能当我的文件超过5M就提示context.Request.Files["Filedata"];代码超出范围
1 回答
大话西游666
TA贡献1817条经验 获得超14个赞
要设置webconfig里面的值
<httpRuntimemaxRequestLengthhttpRuntimemaxRequestLength="1048576"
executionTimeout="3600"/>
- 1 回答
- 0 关注
- 427 浏览
添加回答
举报
0/150
提交
取消