Click here to Skip to main content
15,887,585 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
I have form with different html elements. I want to send the all form data as json and also want o upload file. i successfully collected all form data and convert it into json and passing to the action method. But the problem is i can't able to pass uploaded file also.
please help. My jquery code to send 'json' data to 'SaveForm' action method.


C#
.ajax({
            cache: false,
            type: "POST",
            data:  json,
            async: false,
            url: location.protocol + "//" + location.host + "/Form/SaveForm",
            dataType: "json"
            success: function (Projects) {              
            alert('Form submitted');
            }
        });
Posted
Updated 16-Dec-13 5:18am
v3

1 solution

 
Share this answer
 
Comments
Vi(ky 17-Dec-13 2:54am    
Thanks to reply!This example is good to upload images or any file but the problem is, I am sending json data also to action method. both are not working together. if i am not sending json data then file is successfully uploaded.
Vivekh RF 17-Dec-13 3:15am    
Did your Problem solved or it still persists?
Vi(ky 17-Dec-13 3:58am    
trying to solve
Vivekh RF 17-Dec-13 4:57am    
http://aspzone.com/tech/jquery-file-upload-in-asp-net-mvc-without-using-flash/

THIS IS ALSO A GOOD ONE

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900