public string MyFileUpload() { var request = HttpContext.Current.Request; string filename = request.Headers["filename"]; string FileID = request.Headers["FileID"]; int n = filename.IndexOf('.'); string FileExt = filename.Substring(n); string FileNameSave = FileID + "" + FileExt; var filePath = HttpContext.Current.Server.MapPath("~/PaymentRecepit/" + FileNameSave); using (var fs = new System.IO.FileStream(filePath, System.IO.FileMode.Create)) { request.InputStream.CopyTo(fs); UserClass Obj = new UserClass(); Obj.Fn_UpdateFileName(FileNameSave, FileID); } return("uploaded"); }