javascript - Can't pass data and image into handler .ashx -


i have piece of code sends image , coordinates of cropped image ashx handler.

but can't read in handler.

error: value cannot null. parameter name: path

jquery:

            var pic = new formdata();             jquery.each($("#user_photo")[0].files, function (i, file) {                 pic.append("file-" + i, file);             });              var coords = {                 "c": {                     "x1": x1,                     "x2": x2,                     "y1": y1,                     "y2": y2,                     "w": w,                     "h": h                 }             }              coords = json.stringify(coords);             pic.append("coordenates", coords);              $.ajax({                 url: "handler.ashx",                 type: "post",                 contenttype: false,                 processdata: false,                 cache: false,                 async: true,                 data: pic,                 success: function (data) {                     //window.location = "/profile";                 }         }); 

handler .ashx

    processrequest      {          cropinfo crop = deserialize<cropinfo>(context);          if (context.request.files.count > 0)         { ... }     }      public t deserialize<t>(httpcontext context)     {         string jsondata = new streamreader(context.request.inputstream).readtoend();         var obj = (t)new javascriptserializer().deserialize<t>(jsondata);         return obj;     }      public class cropinfo     {         public string x1 { get; set; }      } 


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -