asp.net mvc - Submit a form with a file upload -


i have simple form 4 input on it.

  • 2 text input
  • 2 check boxes

my current view model posted server following:

public class myviewmodel {     public string firsttext { get; set; }     public string secondtext { get; set; }     public bool firstbool { get; set; }     public bool secondbool { get; set; } } 

this works good. have requirement when secondbool value true ui should upload file server. have modified view model add

public httppostedfilebase uploadedfile { get; set; } 

and modified form having attribute enctype="multipart/form-data"

i use, using bootstrap base ui framework jquery file upload plugin did not through on how post , upload file @ same time. know should easy it.

any hint?

you need add httppostedfilebase uploadedfile post action in controller. cannot pass via model.

e.g.

[httppost] public actionresult myaction(mymodel model, httppostedfilebase uploadedfile) {     //..... stuff here } 

Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -