var onFileUploadChange = function () {
var originalEvent = document.getElementById("fileUpload");
var files = originalEvent.files;
if (typeof FormData == "undefined") {
var data = []; }
else {
var data = new FormData();
}
for (var i = 0; i < files.length ; i++) {
data.append(files[i].name, files[i]); break;
}
$.ajax({
type: "POST",
url: _url,
dataType: "html",
contentType: false,
processData: false,
data: data,
success: function () { },
error: function (xhr) {
console.log(xhr);
}
});
}
I will get the values in "Request" object at c# action method, Is there any way that I will get this value in action method parameter model instead.????
Thanks
Gaurav BabbarPosted Oct 13, 2016, 2:39 AM
Hi Bikesh,
Scenario is,I am uploadingfile. For that I have written javascript code mentioned above which contains "FormData" objectthat has all the information about the file drag over file fileupload control.
CurrentlyI am getting those values in c# action method in "Request" object. But I want value for file uploaded in action parameter like
public Task MyAction(MyModel model)
{
public class MyModel
I want that value in file property of MyModel object.
I hope scenario is clear now.
Thanks.
Bikesh SrivastavaPosted Oct 12, 2016, 8:50 AM