asp.net mvc - mvc file upload and database insert -


i'm getting head wrapped around mvc in .net using vs 2013.

i need little direction in regards uploading file (which easy) inserting data image database. want allow end user enter description, title etc. file being uploaded. on back-end want add meta data 'date created', 'path file', 'category', , file name , couple other pieces of data presenting files in views. don't want insert files in db use path in generated html point physical file end user can view or download it. multiple file types being used, audio, video, documents, images.

i can file upload work writing controller accept file, , end user input, add other fields need database user never sees i'm stuck. blending file upload user fields , beack end data confusing me on how pieces work together.

so in short getting file upload + user input + non-user input values in same view, controller, , model need direction on.

you have upload image plus data in multi-part form.

in view create post form uses "multipart/form-data" encoding, can include inputs model data , file upload control within body of form. when submits will create multi-part form, 1 part contain binary file , part contain data.

on controller action side receive data action akin to

public actionresult postfile(mymodel model, httppostedfilebase file) {...}

there numerous posts on more details won't go that.


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -