2

为什么会这样:

System.Drawing.Image imageBmp =
System.Drawing.Image.FromFile(Server.MapPath("~/Images/Image.jpg"));
imageBmp.Save(Server.MapPath("~/Images2/Image.jpg"),  
System.Drawing.Imaging.ImageFormat.Bmp);
Bitmap bmp = new Bitmap(imageBmp);

这不是吗?(文件名正确)

var fileName = Request.QueryString["name"];
System.Drawing.Image imageBmp = 
System.Drawing.Image.FromFile(Server.MapPath("~/Images/" + fileName));
imageBmp.Save(Server.MapPath("~/Images/" + fileName),
System.Drawing.Imaging.ImageFormat.Bmp);
Bitmap bmp = new Bitmap(imageBmp);
4

1 回答 1

1

此行将尝试将文件保存到自身imageBmp.Save(Server.MapPath("~/Images/" + fileName), System.Drawing.Imaging.ImageFormat.Bmp);

它应该是imageBmp.Save(Server.MapPath("~/Images2/" + fileName), System.Drawing.Imaging.ImageFormat.Bmp);

于 2012-05-17T15:18:12.633 回答