I have a basic form on my Create page in my ASP.NET MVC application. The fields are strongly typed to my model. So, whenever I submit the form, a single record gets inserted into my SQL database. This is fine.

The obstacle I'm encountering is I need to have a file upload control on that same form which will take a file (~50-100mb) and save it to a file share on my company's network. So, the user will fill out the form, choose a file to upload, and when they click "Save", the app will save the form fields to the database, as well as save the uploaded file to a file share.

Should I place all of my logic in the Create action of my controller? Since there will be two separate objects being passed in to my Create action (HttpPostedFileBase file, MyModel model - representing the form fields), how can I accomplish this in the Create action, or do you not recommend that? I honestly have no idea where to even start with this.

QUESTION: How can I do my normal "Create" and save my form fields to the database (I already know how to do this, obviously), in conjunction with saving my uploaded file to a file share somewhere? It'd be easy if the file was saved to the database (not advisable, I know), but it's not.

0

There are 0 answers