Created
February 25, 2015 06:13
-
-
Save asith-w/50c634e5844f395b5582 to your computer and use it in GitHub Desktop.
JS Bin // source http://jsbin.com/bevowe
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<input id="attach" type="file" /><span id="maxSize">(less than 1MB)</span> | |
<script id="jsbin-javascript"> | |
$('#attach').change(addAttachment); | |
function addAttachment() { | |
readURL(this); | |
} | |
function readURL(input) { | |
if (input.files && input.files[0]) { | |
var reader = new FileReader(); | |
reader.onload = function (e) { | |
console.log( e.target.result) | |
} | |
reader.readAsDataURL(input.files[0]); | |
} | |
} | |
</script> | |
<script id="jsbin-source-html" type="text/html"><!DOCTYPE html> | |
<html> | |
<head> | |
<script src="//code.jquery.com/jquery-2.1.1.min.js"><\/script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<input id="attach" type="file" /><span id="maxSize">(less than 1MB)</span> | |
</body> | |
</html></script> | |
<script id="jsbin-source-javascript" type="text/javascript"> | |
$('#attach').change(addAttachment); | |
function addAttachment() { | |
readURL(this); | |
} | |
function readURL(input) { | |
if (input.files && input.files[0]) { | |
var reader = new FileReader(); | |
reader.onload = function (e) { | |
console.log( e.target.result) | |
} | |
reader.readAsDataURL(input.files[0]); | |
} | |
} | |
</script></body> | |
</html> |
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
$('#attach').change(addAttachment); | |
function addAttachment() { | |
readURL(this); | |
} | |
function readURL(input) { | |
if (input.files && input.files[0]) { | |
var reader = new FileReader(); | |
reader.onload = function (e) { | |
console.log( e.target.result) | |
} | |
reader.readAsDataURL(input.files[0]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment