Skip to content

Instantly share code, notes, and snippets.

@Axiol
Created Nov 21, 2012
Embed
What would you like to do?
Preview the image from an input file
// Call this function on the onchange event of the input
function prevVisu(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function(e){
$("div#visuForm").html("<img class='img-polaroid' src='" + e.target.result + "' alt='Preview du visuel'>");
};
reader.readAsDataURL(input.files[0]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment