Ajax文件上传MVC [英] Ajax file Upload MVC
本文介绍了Ajax文件上传MVC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨,,
目前我使用下面的代码上传文件方法=帖子。
Hi,,
Currently I am using below code to upload file with form method = post.
function saveForm(stepTo) {
nextStep = stepTo;
$('#wizard').smartWizard('showLoader');
if ($('#wizard').smartWizard('currentStep') == model.supportingDocPageStepNum) {
var $ele = $("#step-" + model.supportingDocPageStepNum.toString());
var fileUploader = new FileUploader($ele, '@(ViewBag.FileUploadAjaxApiUrl)', ajaxSaveForm);
fileUploader.submit();
}
else {
ajaxSaveForm(null, null);
}
}
我试图用Ajax替换fileUpload。我有不同文件的文件类型,它没有动态生成的id文件名..
我在Ajax的代码下面使用但我不知道如何在下面的方法中传递文件数据...我只是有文件名没有文件ID
I an trying to replace fileUpload with Ajax .I have file type in different file and it has no id it is dynamically generating file names..
I am using below code for Ajax but I dont know how to pass file data in below method... I just have file name no file id
var ajaxRequest = $.ajax({
type: "POST",
url: "/api/fileupload/uploadfile",
contentType: false,
processData: false,
data: data
});
var data = new FormData();
var files = $("#fileUpload") just stuck how t0 get fileData ... can I use something like var x = document.getElementsByName("filename").file
I am getting error
推荐答案
(' #wizard')。smartWizard(' showLoader');
if (
('#wizard').smartWizard('showLoader'); if (
(' #wizard').smartWizard(' currentStep') == model.supportingDocPageStepNum){
var
('#wizard').smartWizard('currentStep') == model.supportingDocPageStepNum) { var
ele =
这篇关于Ajax文件上传MVC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文