在MVC4中上传文件? [英] Upload file in MVC4?
本文介绍了在MVC4中上传文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有不同的html元素的表单。我想将所有表单数据作为json发送,也希望o上传文件。我成功收集了所有表单数据并将其转换为json并传递给action方法。但问题是我也无法传递上传文件。
请帮忙。我的jquery代码将'json'数据发送到'SaveForm'
动作方法。
I have form with different html elements. I want to send the all form data as json and also want o upload file. i successfully collected all form data and convert it into json and passing to the action method. But the problem is i can't able to pass uploaded file also.
please help. My jquery code to send 'json' data to 'SaveForm'
action method.
.ajax({
cache: false,
type: "POST",
data: json,
async: false,
url: location.protocol + "//" + location.host + "/Form/SaveForm",
dataType: "json"
success: function (Projects) {
alert('Form submitted');
}
});
推荐答案
http://brian-federici.com/blog/2012/ 8/31 / aspnet-mvc4-file-upload [ ^ ]
这篇关于在MVC4中上传文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文