Skip to content

Instantly share code, notes, and snippets.

@rpaskin
Created June 6, 2019 15:53
Show Gist options
  • Save rpaskin/4d59206ad8bb9a577c134fcf3ed34209 to your computer and use it in GitHub Desktop.
Save rpaskin/4d59206ad8bb9a577c134fcf3ed34209 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title>Test Opera</title>
<script src="//cdn.jsdelivr.net/gh/ethereum/[email protected]/dist/web3.min.js" type="text/javascript"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/js-sha3/0.8.0/sha3.min.js" type="text/javascript"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/zepto/1.2.0/zepto.min.js" type="text/javascript" charset="utf-8" async defer></script>
<script type="text/javascript">
const web3 = new Web3(ethereum);
const storage = window.localStorage;
</script>
</head>
<body>
<form action="submit" method="get" accept-charset="utf-8" onsubmit="return false;">
<input type="file" onchange="hashFile(this)" id="my_document" multipe=false class="inputfile">
</form>
<script type="text/javascript">
function hashFile(el) {
var fr = new FileReader();
fr.onload = function (ev) {
console.log(26,ev,fr);
var data = ev.srcElement.result;
console.log(28, data);
};
console.log(el, el.files);
fr.readAsArrayBuffer(el.files[0]);
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment