Skip to content

Instantly share code, notes, and snippets.

@kucukkanat
Last active August 29, 2015 14:05
Show Gist options
  • Save kucukkanat/791f3239d9af2ec1dafc to your computer and use it in GitHub Desktop.
Save kucukkanat/791f3239d9af2ec1dafc to your computer and use it in GitHub Desktop.
File API get input value
$(document).on('change','#imageUpload',function(e){
var input = e.target;
var file = input.files[0];
var reader = new FileReader();
var dataURL = reader.readAsDataURL(file);
reader.onload = function(){
var src = reader.result;
$("#uImagePrev").css({"background-image":"url("+src+")"});
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment