简体   繁体   中英

The given path's format is not supported.SaveAs

Following is my code,

              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);

I'm getting error saying 'The given path's format is not supported'.What will be the issue?

firstly what u have passed to "FileUpload1"

and y cant u try this

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM