简体   繁体   English

ASP.Net MVC & jQuery 表单插件上传文件

[英]ASP.Net MVC & jQuery Form Plugin Uploading a File

Can someone give me an example of how to do this with ASP.Net MVC?有人可以给我一个如何使用 ASP.Net MVC 执行此操作的示例吗? I have followed the example at their site on the file uploads tab but I cannot get a decent response back.我在文件上传选项卡上按照他们网站上的示例进行了操作,但我无法得到像样的回复。 My controller thinks that it is not a AJAXRequest and tries to do a RedirectToAction but that doesn't change the page after the post.我的 controller 认为它不是 AJAXRequest 并尝试执行 RedirectToAction 但这不会在发布后更改页面。

I wrote a blog post about how to do this here .在这里写了一篇关于如何做到这一点的博客文章。

The upload isn't an AJAX request, it states clearly that you can't do a file upload using the XMLHttpRequest object so it's done using an iframe as the target.上传不是 AJAX 请求,它清楚地表明您不能使用 XMLHttpRequest object 进行文件上传,因此它是使用 iframe 作为目标完成的。 Try processing the upload just as you would for a normal non-AJAX submission.尝试像处理正常的非 AJAX 提交一样处理上传。

Answer: Cannot use AJAX or use iFrame答:不能用AJAX或者用iFrame

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM