I'm trying to upload file using dojo/_base/xhr here is the code:
xhr.post({
url: postUrl,
handleAs: "text",
contentType: "application/json",
timeout: 10000,
postData: dojo.toJson({ file: Uploader.files[0]}),
load: function (result) {
show image...
},
error: function (err) {
show error...
}
});
when I try to send Uploader.files[0].size
I get the value I should get, but when I try to send Uploader.files[0]
or Uploader.files[0]
I get null.
On the server side:
[HttpPost]
public string UploadImg(string file)
{
` Saving file
}
I tried everything!! But I can't manage to get the file itself. Request.Files
returns 0 files. Submitting a form isn't an option and when I use
xhr.post({
form: dom.byId("myform"),
handleAs: "text",
timeout: 10000,
load: function (result) {
show image...
},
error: function (err) {
show error...
}
Request.Files
returns 0