Last active
February 8, 2019 09:54
-
-
Save melvinstanly/cead91b21b9ff955a5e064cad29362d5 to your computer and use it in GitHub Desktop.
File Preview Before Upload jQuery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function readURL(input){ | |
if (input.files && input.files[0]) { | |
var reader = new FileReader(); | |
reader.onload = function (e) { | |
//e.target.result ->contain image url in encoded form | |
//Do action with e.target.result here. Dont place outside onload function. won't work | |
}; | |
reader.readAsDataURL(input.files[0]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment