Created
January 22, 2014 08:15
-
-
Save sharmaansh21/8555181 to your computer and use it in GitHub Desktop.
Image view
This file contains hidden or 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
| $(document).ready(function(){ | |
| var preview = $(".upload-preview img"); | |
| $(".file").change(function(event){ | |
| var input = $(event.currentTarget); | |
| var file = input[0].files[0]; | |
| var reader = new FileReader(); | |
| reader.onload = function(e){ | |
| image_base64 = e.target.result; | |
| preview.attr("src", image_base64); | |
| }; | |
| reader.readAsDataURL(file); | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment