0

If my Razor is coded with @Html.BeginForm (enctype = "multipart/form-data") for my file upload, it will always return me a new page instead of to my DIV tag column. @Ajax.BeginForm offers DIV tag control, but in some circumstances, I have to use the hack with the Javascript and IE doesn't support on it.

Is there a way for me avoid page redirection by using @Html.BeginForm because I want to maintain my web design as much as SPA. Thanks.

Divyang Desai
  • 7,483
  • 13
  • 50
  • 76
lannyboy
  • 843
  • 1
  • 12
  • 22
  • if you are trying to upload a file with ajax just by posting the form then it will postback your whole page and you will see full page postback. There are certain ways to post a file using ajax. 1.) Use some jQuery fileupload plugin 2.) send base 64 data to server if your are uploading image. – Ankush Jain Aug 24 '16 at 04:10
  • 1
    You cannot use `@Ajax.BeginForm()` to upload files, but you can use `FormData` - refer [this answer](http://stackoverflow.com/questions/29293637/how-to-append-whole-set-of-model-to-formdata-and-obtain-it-in-mvc/29293681#29293681) –  Aug 24 '16 at 06:30

0 Answers0