File Upload using recent Bootstrap file upload and mvc asp.net -


i looked on other answers , solutions there not working. , couldn't seem figure out why. using bootstrap 3.0. trying use upload new avatar image. problem comes null , cannot seem figure out why.

here html:

@using (html.beginform("editavatar", "profile", new { userid = @model.propit_user.userid }, formmethod.post, new { })) {     <div class="form-group">         <div class="fileinput fileinput-new" data-provides="fileinput">             <div class="fileinput-new thumbnail" style="width: 200px; height: 150px;">                 <img src="http://www.placehold.it/200x150/efefef/aaaaaa&amp;text=no+image" alt="" />             </div>             <div class="fileinput-preview fileinput-exists thumbnail" style="max-width: 200px; max-height: 150px;">             </div>             <div>                 <span class="btn default btn-file">                     <span class="fileinput-new">select image                     </span>                     <span class="fileinput-exists">change                     </span>                     <input id="avatar_image" type="file" name="..." runat="server">                 </span>                 <a href="#" class="btn default fileinput-exists" data-dismiss="fileinput">remove                 </a>             </div>         </div>         <div class="clearfix margin-top-10">             <span class="label label-danger">note!             </span>             <span>attached image thumbnail supported in latest firefox, chrome, opera, safari , internet explorer 10             </span>         </div>     </div>     <div class="margin-top-10">         <button type="submit" class="btn green">             save changes         </button>         <button type="reset" class="btn default">cancel</button>     </div> } 

i have given file input id of avatar_image

here controller:

[httppost]         public actionresult editavatar(htmlinputfile avatar_image)         {              if (avatar_image.postedfile != null)             {                 //do whatever want file             }              return view();         } 

when looking @ break point avatar_image.postedfile null. have idea missing?

you might check request in fiddler. more importantly though, need add enctype="multipart/form-data" attribute form.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -