Created
May 14, 2013 20:14
-
-
Save kalexander/5579118 to your computer and use it in GitHub Desktop.
playing with file contents on the client side....
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
<html> | |
<body> | |
<form name="uploadForm"> | |
<input id="uploadFile" type="file" name="uploadFile" onchange="performFilePoop();" /> | |
</form> | |
<script> | |
function performFilePoop(){ | |
var files = document.getElementById("uploadFile").files | |
if(files.length == 1){ | |
var fileReader = new FileReader() | |
fileReader.onload = function(event){ | |
alert(event.target.result) | |
} | |
alert(files[0].name) | |
fileReader.readAsText(files[0]) | |
} | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment