如何上传与jQuery文件MVC Web服务器VNext? [英] How to upload file with JQuery to MVC VNext webserver?
本文介绍了如何上传与jQuery文件MVC Web服务器VNext?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望能够将文件发送到MVC VNext网络服务器。
I want to be able to send a file to a MVC VNext webserver.
我读过这篇文章,它的工作原理和都很好。但是,如何把它上传文件,而无需使用<形式为GT;
I've read this article, it works and its all good. But how do it upload a file without using <form>
?
这样做的原因,是因为我要上传的文件,而无需加载了新的一页。
The reason for this, is because i want to upload a file without loading a new page.
我读过这文章,但它似乎没有上班。参数IFormFile是百达空。
I've read this article, but it doesn't seem to work. The parameter IFormFile is allways null.
推荐答案
尝试使用输入类型=文件
, FORMDATA
, $。员额()
$.ajaxSetup({processData:false,contentType:false});
$("input[type=file]").change(function() {
var data = new FormData(); data.append("file", this.files[0]);
$.post("/path/to/server", data)
});
另外,转换文件 JSON
对象<一个href=\"http://stackoverflow.com/questions/28856729/upload-multiple-image-using-ajax-php-and-jquery\">Upload多种图像使用AJAX,PHP和jQuery
这篇关于如何上传与jQuery文件MVC Web服务器VNext?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文