I would like to get the path of a file to later upload it to my server. I have a button in the Views such that :
@Html.EditorFor(model => model.Imagen, new { htmlAttributes =
new { @class = "input", @type = "file" }
The problem is that in the controller I only get the name of the file and I need the full path. As I have investigated this is because modern browsers do not allow it for security. In that case, what would be the valid way to get the route?
The correct way to receive a file is not that you know its path, but the way the browser sends it to the server, which is basically bytes.
To achieve that you need to mark your form with the encoding type:
And in your action method (ActionMethod), receive the file respectively, for example: