1
IAM試圖handdle用下面這段代碼上傳的文件,但我得到這個錯誤Request
參考需要我曾嘗試使用system.web.httprequest
處理Ajax FORMDATA
[System.Web.Services.WebMethod]
public static string UploadFile(string ParentPath)
{
for (int i = 0; i < Request.Files.Count; i++)
{
var file = Requset.Files[i];
var fileName = Path.GetFileName(file.FileName);
var path = Path.Combine(Server.MapPath("~/Junk/"), fileName);
file.SaveAs(path);
}
}
添加[使用MVC 4和Ajax進行文件上傳]的可能的副本(https://stackoverflow.com/questions/20420828/file-upload-using-mvc-4-with-ajax) – Isma