guys i am trying to load file from view to controller with out using form , while browsing a file the file should be loaded to controller using Ajax ,is it possible?
<td>Import Excell file:</td>
<td><input type="file" id="fileUpload" name="fileUpload" /></td>
$('#fileUpload').die().live("change", function (e) {
e.preventDefault();
var file_name = $("#fileUpload").val();
var fileName = $("#fileUpload").val();
var fileExtension = fileName.substring(fileName.lastIndexOf('.') + 1);
var file_data = $("#fileUpload").prop("files")[0];
var form_data = new FormData();
form_data.append("file", file_data);
alert("hahaha");
$.ajax({
type: 'POST',
url: '@Url.Action("ImportExcell","Uploadfile")',
data: form_data,
contentType: false,
enctype: 'multipart/form-data',
processData: false,
success: function (response) {
alert(response);
}
});
});


FormData, but this solution may not run in some old browser versions like IE9. If you are only targeting new browsers, I can give you solution.