测试区的web.config没有配置requestLengthDiskThreshold,正式区好像也没有,但是在
正式区上传附件报“Cannot access a closed file”,请问怎么解决?
if (fupFile.PostedFile != null && fupFile.PostedFile.ContentLength > 0)
{
if (fupFile.HasFile)
{
ListItem item = new ListItem();
item.Value = item.Text = fupFile.PostedFile.FileName;
if (!lbxFile.Items.Contains(item))
{
lbxFile.Items.Add(item);
files.Add(fupFile);
}
}
if (files.Count > 0)
{
string WF_NO;
string WF_Sale;
string filename = "";
string path = "d:\\Lorom\\ProductCenter\\WorkFlow\\FTPFile\\" + Session["wf_sale"].ToString() + "\\" + Session["WF_NO"].ToString() + "\\";
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
lblShow.Text = fupFile.PostedFile.FileName;
WF_Sale = Session["UserNO"].ToString();
WF_NO = Session["WF_NO"].ToString();
WCFHelperBase wcfBase = new WCFHelperBase();
foreach (FileUpload fup in files)
{
if (fup.HasFile)
filename = fup.FileName;
//string extend = Path.GetExtension(filename);
// fupFile.PostedFile.SaveAs(Server.MapPath(path)+"\\"+filename);
// Directory.CreateDirectory(path);
//myFile.SaveAs(path + fupFile);
wcfBase.csHelper.GetUnsignFile(WF_NO, filename, WF_Sale);
fup.SaveAs(path + "/" + fup.FileName);//无法访问已关闭的文件
}
//Page.ClientScript.RegisterClientScriptBlock(typeof(string), "", @"<script>alert('上传成功!')</script>");
wcfBase.CloseWCF();
Response.AddHeader("Refresh", "0");
}
}