ASP.NET上传的问题!!
我写的一段上传文件的代码,上传文件时出错,提示找不到文件,,,当本地的文件路径没有错,而且只有当服务器端同样的路径下有同名文件存在时上传开成功,,不知道问题出在哪里??请大伙帮我看看。。。。代码如下:
protected System.Web.UI.WebControls.TextBox txttAccessoryID;
protected System.Web.UI.WebControls.TextBox txtAccessoryID;
protected System.Web.UI.WebControls.TextBox txtAccessory;
protected System.Web.UI.HtmlControls.HtmlInputFile upaccessory;
private void btnup_Click(object sender, System.EventArgs e)
{
if(upaccessory.PostedFile.FileName != "")
{
string convert;
string strFullPath=upaccessory.PostedFile.FileName;
string filename=strFullPath.Substring(strFullPath.LastIndexOf("\\") + 1);
string extent=filename.Substring(filename.LastIndexOf(".")+1);
txtAccessory.Text+=filename;
convert = DateTime.Now.ToString()+"."+extent;
convert = convert.Replace(":","-");
txtAccessoryID.Text += convert;
filename=txtAccessoryID.Text;
string path=Server.MapPath("file");
upaccessory.PostedFile.SaveAs(path+"\\"+filename);
}
}