MVC 4 with jQuery Mobile - unable to upload file using post

I am trying to load a file in MVC 4 Internet Mobile Project (from template ..) anyway, the code works fine until I add the jQuery Mobile library to the page and the file is passed to the controller empty.

[HttpPost]
public ActionResult FileUpload(HttpPostedFileBase file)  
                                        --> file is null when using JQuery Mobile

      

Can anyone show an example of including a message to receive files?

EDIT: From another check I did, it seems that when a file is selected from the filesystem, it outputs as null. checked it with javscript to see what happens when the file is modified.

0


source to share


1 answer


jQuery Mobile AJAXizes forms and as you already know it is not possible to upload files using AJAX. As a workaround, you can add an attribute data-ajax="false"

to the element <form>

to prevent jQuery Mobile from capturing it and using AJAX.



+2


source







All Articles