Archive for the ‘XHTML’ Category

Hello everyone.

some time we need to show image preview  as user, admin browse any image to post to db or to move to server directory here is the code. i hope it will be helpful for you

#prevImage {
border: 8px solid #ccc;
width: 300px;
height: 200px;

function setImage(file) {
document.getElementById('prevImage').src = file.value;
document.getElementById('prevImage').src = file.files.item(0).getAsDataURL();
if(document.getElementById('prevImage').src.length > 0)
document.getElementById('prevImage').style.display = 'block';


//body section