我在Asp.Net
工作,我要上傳文件到服務器時,它顯示我SaveAs
方法被配置到需要有根通路中的錯誤文件上傳到服務器
,路徑 〜/ 192。 zzz.zzz.z/CaheadServices/ImagesNIINIR.jpg'沒有紮根。
這裏是我的代碼
protected void btnUpload_Click(object sender, EventArgs e)
{
try
{
fup.SaveAs("~/192.zzz.zzz.z/CaheadServices/Images" + fup.FileName);
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
}
請幫助我。
如果你想要把它放在你的文檔暴露樹下,你需要使用HttpServerUtility.MapPath(http://msdn.microsoft.com/en-us/library/system.web.httpserverutility .mappath.aspx)來獲取將文件保存到的目錄的完全限定路徑。 –