I'm wondering if it would be possible at all to upload a file by posting it to a controller action in ASP.NET MVC. The dialog for this upload form will be dynamically generated and will be inside a jQuery dialog in my case.
I'm aware of the file input element but I'm not sure how to send the file to a controller action, not sure how to set the action
parameter
Your action should like this:
Taken from :http://haacked.com/archive/2010/07/16/uploading-files-with-aspnetmvc.aspx/
Then using jQuery Dialog for file upload:
//Put this form in modal
and Make Submit event will send file to Action.There you can access file as in Model element as like UploadedFileData .