model view controller - Insert image into database with c# -


i want upload image database (shoppingitems) or save image folder in project , insert path of image db. can help? code (view):

@using (html.beginform("index3", "upload", formmethod.post)) {     @html.textboxfor(x => x.itemname, new { @class = "form-control", placeholder = "item name", required = "required" })     <br />      @html.textboxfor(x => x.price, new { @class = "form-control", placeholder = "item price", required = "required" })     <br />      @html.textboxfor(x => x.quantity, new { @class = "form-control", placeholder = "item quantity"})     <br />      @html.textboxfor(x => x.authoridentity, new { @class = "form-control", placeholder = "username", required = "required" })     <br />      // image upload should       <br />      @html.textboxfor(x => x.category, new { @class = "form-control", placeholder = "item category", required = "required" })     <br />      @html.textareafor(x => x.description, new { @class = "form-control", placeholder = "item description", required = "required" })     <br />      <input type="submit" class="btn btn-danger" value="add" /> } 

controller:

public actionresult index3(shoppingitem formmodel); {     using (var ctx = new gikgamermodeldatacontext())     {         if (formmodel == null)             return view();          ctx.shoppingitems.insertonsubmit(formmodel);         ctx.submitchanges();     }      return view(); } 

my upload index (index3) shows text says upload successful or unsuccessful haven't added :)

in form in order upload have specify attribute enctype : value "multipart/form-data" can foloow examples in response try : uploading/displaying images in mvc 4

hope helps


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -