0
是否有可能返回上傳到ajax的每個文件的路徑,因爲我需要顯示剛剛在前端上傳的圖像。如何從控制器返回更新文件到ajax的文件路徑
public ActionResult Upload()
{
for (int i = 0; i < Request.Files.Count; i++)
{
var file = Request.Files[i];
var fileName = Path.GetFileName(file.FileName);
var path = Path.Combine(Server.MapPath("~/Images/img"), fileName);
file.SaveAs(path);
}
return Json(new { Success = true, FilePath = "ssssss" });
}