asp.net mvc - How to check enctype at the MVC Controller? -
is possible check @ controller action see if data posted enctype="multipart/form-data
form? how?
update: got form file upload.
@using (html.beginform("create", "report", formmethod.post, new {@class = "form-horizontal", enctype = "multipart/form-data"})) { .... }
on controller, accept post.
[httppost] public actionresult create(inputmodel model){ .... }
is there anyway can tell if data posted action multipart
enctype form or regular form?
say, there regular form on page, has no file upload. wants post same action.
not idea, can try it.
add hidden property @ view like
@html.hiddenfor(m => m.hiddenpropertyname)
then check value @ controller
if(model.hiddenpropertyname == "somevalue") // upload file or else // work
Comments
Post a Comment