I have a file input control:
<input type="file" id="fileUploadControl" />
On selecting an image file using this file control the selected image src
has to be updated in img
tag:
<img id="profileImage" width="80%" height="80%" />
I used the folowing jQuery code to update the src
:
$("#fileUploadControl").on('change', function(){
$("#profileImage ").attr('src', 'url(file://' + $(this).val() + ')');
})
The above code works in ordinary HTML page but when I use this code inside the MVC 4 .cshtml file it didn't work.
What is the reason and how do I overcome this problem?