ASP.NET MVC file uploading with different inputs -


i search problem, seems easy did not correct answer.

here html code

<input type="file" name="smallimage" id="smallimage" />  <input type="file" name="largeimage" id="largeimage" /> 

i can files request.files, not give me html file input info file coming from.

as see, must understand file input element sends file.

edit: try did not work also

request.files["smallimage"] 

you should use 2 arguments of type httppostedfilebase in httppost action method same name of input field(s).

[httppost] public actionresult create(httppostedfilebase smallimage,                                                      httppostedfilebase largeimage) {   // check smallimage & largeimage here   //  : return } 

assuming form action value set action method

@using (html.beginform("create", "yourcontrollername", formmethod.post,                                           new { enctype = "multipart/form-data" })) {    <input type="file" name="smallimage" />     <input type="file" name="largeimage" />     <input type="submit" /> } 

Comments

Popular posts from this blog

routing - AngularJS State management ->load multiple states in one page -

python - GRASS parser() error -

json - Gson().fromJson(jsonResult, Myobject.class) return values in 0's -