HtmlHelper for a FILE type input

0

I have a little doubt, I need to generate an input of type File to save images in my BD, I'm using razor views in asp.net mvc 5, but I can not find how to do it by HtmlHelper , but I see that gives you none for this type of input, any ideas on how to achieve it?

I do not attach code since I am only interested at the moment having it in my view using an HtmlHelper but without functionality.

    
asked by Melanie 14.07.2017 в 22:44
source

1 answer

0

If you have the attribute in your model, you could do it this way

@Html.EditorFor(m=>m.Archivo, new { htmlAttributes = new { @type="file" } })

and if you do not have it the following

@Html.Editor("Archivo", new { htmlAttributes = new { @type="file" } })

you just have to add the file type in the attributes of the helper

    
answered by 14.07.2017 / 23:21
source