Skip to content

Instantly share code, notes, and snippets.

@linmx0130
Last active August 29, 2015 14:17
Show Gist options
  • Select an option

  • Save linmx0130/13b389218a6f3d20d301 to your computer and use it in GitHub Desktop.

Select an option

Save linmx0130/13b389218a6f3d20d301 to your computer and use it in GitHub Desktop.
<html>
<head>
<script>
fReader=new FileReader();
fReader.onload=function(evt){
document.getElementById("viewer").innerHTML=evt.target.result;
};
function loadFile(){
var oFile = document.getElementById("loader").files[0];
fReader.readAsText(oFile,"utf-8");
}
</script>
</head>
<body>
<form id="loaderForm">
<input id="loader" type="file" onchange="loadFile();">
</form>
<div id="viewer">
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment