TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
meenakshi luthra
NA
48
4.5k
issue in Ajax call while uploading excel file
Apr 18 2018 12:43 AM
Hi,
I have following Jquery in mvc core view:
$(document).ready(function () {
$("#btnUploadSave").click(function () {
var fileUpload = $("#files").get(0);
var files = fileUpload.files;
var data = new FormData();
for (var i = 0; i < files.length; i++) {
data.append(files[i].name, files[i]);
}
$.ajax({
type: "POST",
url: "/Creator/SaveBatchMenbersFromExcel",
contentType: false,
processData: false,
datatype : json,
data: data,
headers: { __RequestVerificationToken: $("input[name=__RequestVerificationToken]").val() },
success: function (message) {
alert(message);
$("#txtExcelFile").val('');
$("#txtExcelFile").attr("placeholder", "Drop a file here!");
$('#ddlBatchCsv').prop('selectedIndex', 0);
},
error: function () {
alert("There was error uploading files!");
}
});
});
and below is the html of input
<input type="file" id="files" name="filesToUpload[]" style="display:none;" class="file">
while saving data of excel file I am always getting alert of error function. Please help me where is the mistake??
Reply
Answers (
13
)
Query & SubQuery LINQ MVC
WEBAPI, MVC, DAL, BLL in separate projects of same solution