我上傳文件使用asp.net fileupload控制,每當回發發生由於頁面上的其他字段,文件上傳控制丟失選定的路徑。我在頁面上使用多個文件上傳控件來進行比較。目的如何解決這個問題?親愛的合適的例子請幫助簡單&。如何解決回發問題文件上傳控制的路徑不存在
string file = Path.GetFileName(UploadSalesServiceCopy.PostedFile.FileName);
string filepath2 = ConfigurationManager.AppSettings["ServerMapImgPath"].ToString();//.......local drive path via web config
string subPath = filepath2 + file;
bool IsExists = System.IO.Directory.Exists(Server.MapPath(subPath));
if (!IsExists)
System.IO.Directory.CreateDirectory(Server.MapPath(subPath));
if (UploadSalesServiceCopy.HasFile)
{
//UploadSalesServiceCopy.SaveAs(subPath);//PHYSICAL path
UploadSalesServiceCopy.SaveAs(Server.MapPath(subPath));//server path
}
else
{
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "javascript", "alert('No File Selected.')", true);
}
你能指定這些代碼的位置嗎? – lexeRoy 2013-04-25 06:22:09