2014-05-21 70 views
0

以下是我的代码,给定的路径的格式不supported.SaveAs

   string path1 = string.Format("{0}/{1}", Server.MapPath("~/Content/UploadedFolder"), Request.Files 
        ["FileUpload1"].FileName); 
       if (System.IO.File.Exists(path1)) 
       System.IO.File.Delete(path1); 

       Request.Files["FileUpload1"].SaveAs(path1); 

我收到提示说“给定的路径的格式不supported'.What将成为问题?

回答

0

首先什么ü已记入 “FileUpload1”

和Y斜面ü尝试这个

FileUploadPhoto.SaveAs(Server.MapPath("/UplodedImages/") + Path.GetFileName(FileUploadPhoto.FileName)); 
      ImageUpload.ImageUrl = "~/UplodedImages/" + Path.GetFileName(FileUploadPhoto.FileName); 
相关问题