-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpicPreview.html
40 lines (39 loc) · 939 Bytes
/
picPreview.html
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
31
32
33
34
35
36
37
38
39
40
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<script src="http://code.jquery.com/jquery-1.9.0.js"></script>
<script type="text/javascript">
$(function(){
$("#File1").on("change",function(){
var file=this.files[0];
if(this.files&&file)
{
var reader=new FileReader();
reader.onload=function(e){
$("#img1").attr("src",e.target.result);
$("#fn").text(file.name);
$("#fs").text(file.size+" bytes");
}
reader.readAsDataURL(file);
}
});
});
</script>
</head>
<body>
<div>
<input id="File1" type="file" />
<br/>
<img id="img1" src="" alt="" />
<br/>
<span id="fn" ></span>
<br/>
<span id="fs" ></span>
</div>
</body>
</html>