无法访问已关闭的文件,在上传附件的时候出现问题!
·我在本地可以上传几M的文件,但放到服务器上后就只能上传几十KB的文件,一旦大于100KB左右,就会报无法访问已关闭的文件...
已经在WEB里加了<httpRuntime maxRequestLength="102400" executionTimeout="60"/>但还是没有用··请高手指教
HttpFileCollection fileList = Request.Files;
string attahDir = Server.MapPath("Attahments");
string userDir = attahDir + "/" + name;
if (!Directory.Exists(userDir))
{
Directory.CreateDirectory(userDir);
}
for (int i = 0; i < fileList.Count-1; i++)
{
HttpPostedFile file = fileList[i];
if (file.FileName.Length <= 0 || file.ContentLength <= 0) continue;
//Attachment attachment = new Attachment(file.FileName);
size += file.ContentLength;
string attachname = DateTime.Now.ToString("yyyyMMddHHmmss") + file.FileName.Substring(file.FileName.LastIndexOf("\\") + 1);
filename = filename + "?" + attachname;
file.SaveAs(userDir + "/" + attachname);《--这里会报错!无法访问已关闭的文件....
}