In the large amount of similar questions, I wasn't able to really find what I need, despite it seems to be very common...
I have a user profile Form. So the user can upload an avatar. It uses a common 'Browse...' button but this one will inform the server on the next submit.
So I would like to retrieve the local image filename and directory path to immediately display the selected image.
<img src="" id="image_to_display" class="img-responsive" alt=""/>
<form enctype="multipart/form-data" method="post" accept-charset="utf-8" role="form" action="/pros/sites/add">
<input class="form-control" value="POST" type="hidden" name="_method" id="_method" />
<fieldset>
<div class="form-group file">
<input type="file" name="logofile" onchange="loadImg('logofile');" id="logofile">
</div>
.....
</fieldset>
.....
</form>
From document.getElementById("logofile"), I can only get the image name, not the pathname.
How to do it?