Skip to content

Instantly share code, notes, and snippets.

@DonKarlssonSan
Last active August 29, 2015 14:14
Show Gist options
  • Save DonKarlssonSan/56c44fae358f3d54abe0 to your computer and use it in GitHub Desktop.
Save DonKarlssonSan/56c44fae358f3d54abe0 to your computer and use it in GitHub Desktop.
<html>
<body>
<input id="image" type="file" accept="image/*" />
<script>
(function () {
var image = document.getElementById("image");
image.addEventListener("change", function (event) {
var files = event.target.files;
if (files.length > 0) {
alert(files[0]);
}
});
})();
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment