Created
January 30, 2020 12:13
-
-
Save kayode-adechinan/5d85ecc34e7bc94d582aff10c3473046 to your computer and use it in GitHub Desktop.
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>repl.it</title> | |
</head> | |
<body> | |
<div>Click the upload icon below to upload a file.</div> | |
<img id="output"/> | |
<img id="imgFileUpload" alt="Select File" title="Select File" src="https://speckyboy.com/wp-content/uploads/2017/12/open-source-file-upload-fields-thumb.png" | |
width="100" | |
height="100" | |
style="cursor: pointer" /> | |
<br /> | |
<span id="spnFilePath"></span> | |
<input type="file" id="FileUpload1" style="display: none" /> | |
<script type="text/javascript"> | |
window.onload = function () { | |
var fileupload = document.getElementById("FileUpload1"); | |
var filePath = document.getElementById("spnFilePath"); | |
var image = document.getElementById("imgFileUpload"); | |
image.onclick = function () { | |
fileupload.click(); | |
}; | |
fileupload.onchange = function () { | |
var output = document.getElementById('output'); | |
output.src = URL.createObjectURL(event.target.files[0]); | |
}; | |
}; | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment