0
我想上傳圖像,當我嘗試image.Save()時,我得到一個「通用GDI +」錯誤。任何幫助都會很棒。MVC4 - 上傳圖像 - 通用GDI +錯誤
// This action handles the form POST and the upload
[HttpPost]
public ActionResult Index(HttpPostedFileBase file, string filename)
{
// Verify that the user selected a file
if (file != null && file.ContentLength > 0)
{
string location = "~/Content/Images/Specials/" + "rttest" + ".jpg";
Bitmap bitmap = new Bitmap(file.InputStream);
Image image = (Image)bitmap;
image.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg);
image.Save(location);
}
// redirect back to the index action to show the form once again
return RedirectToAction("Index");
}