我正在尝试在我的项目Releases文件夹中上传图片。但它不是在所需的位置上传。即使它显示"文件已成功上传"消息。
控制器:
public ActionResult UploadImages(HttpPostedFileBase photo_url)
{
if (photo_url != null)
try
{
photo_url.SaveAs(Path.Combine(HttpContext.Server.MapPath("~/Images/Releases"),
photo_url.FileName));
ViewBag.Message = "File uploaded successfully";
}
catch (Exception ex)
{
ViewBag.Message = "ERROR:" + ex.Message.ToString();
}
else
{
ViewBag.Message = "You have not specified a file.";
}
return View();
}