upload photo and preview photo

 <div>

<input type="file" id="myImage" name="">

</div>


<div class='loo'>

<img id="previewImage" >

</div>



<script type="text/javascript">

var imageUplaod = document.getElementById('myImage');

var showImage = document.getElementById('previewImage');

imageUplaod.addEventListener("change",function (event) {

if (event.target.files.length == 0) {

return;

}

var tempURL = URL.createObjectURL(event.target.files[0]);

showImage.setAttribute("src",tempURL);


});


https://stackoverflow.com/questions/22293023/get-full-image-path-and-put-in-img-src-using-javascript/24773442



https://stackoverflow.com/questions/6365858/use-jquery-to-get-the-file-inputs-selected-filename-without-the-path




Post a Comment

0 Comments