handle ajax posted data in C# -


  function uploadfiles() {     var formdata = new formdata();     $.each(files, function (key, value) {         formdata.append(key, value);     });      $.ajax         ({             url: "../../home.aspx/uploadfile",             type: 'post',             data: formdata,             cache: false,             processdata: false,             contenttype: false,              success: function (data, textstatus, jqxhr) {                 if (typeof data.error === 'undefined') {                     // success call function process form                     submitform(event, data);                 }                 else {                     // handle errors here                     console.log('errors: ' + data.error);                 }             },              error: function (jqxhr, textstatus, errorthrown) {                  console.log('errors: ' + textstatus);              }         }); 

i have ajax request sends file end code.
how can handle file , upload server directory , datatype ajax request should send end.

 [system.web.services.webmethod]              public static string uploadfile(string parentpath)             {                   (int = 0; <   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);                 }              } 

iam trying code backend error 'request' object reference required have tried add using system.web.httprequest


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -