I am trying to handle uploaded files with this code below, but I get an error that Request
reference is required. I tried to add a reference to system.web.httprequest
, but this did not fix the problem.
Here is my method:
[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);
}
}