I am developing an application MVC .Net
that has a visual part in cshtml
. The problem comes in the following part: I have a button to select a file defined like this:
<div class="col-sm-4">
@Html.TextBoxFor(m => m.Data, new { type = "file", @class = "upload " })
@Html.LabelFor(m => m.Data,"Upload File...", new { type = "file", @class = "btn btn-primary" })
</div>
It is this way to be able to style it and make it look like a button, it is shown as follows:
The problem is that when I select a file the text value is not changed Upload File...
. Is there some kind of event that is fired when select a file? What is the optimal way to do this? All the best
The event
change
fires when you upload a file. For example with jquery you could do like this: