-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathsample.html
More file actions
30 lines (26 loc) · 972 Bytes
/
sample.html
File metadata and controls
30 lines (26 loc) · 972 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<HTML>
<TITLE>File Upload and Display Test Screen</TITLE>
<!-- This code is available and was borrowed from the sample on the web at https://codepen.io/mobifreaks/pen/LIbca
Moved to this github so the author could have slightly more control, so the code won't "go away" etc.
-->
<HEAD>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<SCRIPT:type="text/javascript">
function readURL(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#blah')
.attr('src', e.target.result);
};
reader.readAsDataURL(input.files[0]);
}
}
</SCRIPT>
</HEAD>
<BODY>
File to upload:
<input type='file' onchange="readURL(this);" />
<img id="blah" src="http://placehold.it/180" alt="your image" />
<BODY>
</HTML>