4

Can someone give me an example of how to do this with 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.

4 Answers 4

14

I wrote a blog post about how to do this here.

Sign up to request clarification or add additional context in comments.

Comments

0

Try this my friend: http://www.hanselman.com/blog/ABackToBasicsCaseStudyImplementingHTTPFileUploadWithASPNETMVCIncludingTestsAndMocks.aspx

2 Comments

That doesn't use the jQuery Form Plugin
Perhaps you would prefer this post then! forums.asp.net/p/1298139/2527969.aspx#2527969
0

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. Try processing the upload just as you would for a normal non-AJAX submission.

1 Comment

I do, I check the Request.IsAJAXRequest property and then do a RedirectToAction("Index") but I don't get redirected to Index it just comes back to my form page.
-6

Answer: Cannot use AJAX or use iFrame

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.