-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path上传.html
26 lines (26 loc) · 837 Bytes
/
上传.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
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="Generator" content="EditPlus®">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<title>Document</title>
</head>
<script type="text/javascript">
function getFileSize(fileObj)
{
//不能使用new Image,ie下报无dynsrc属性
var img1 = document.getElementById('img1');
img1.dynsrc=fileObj.value;
//img1.fileSize:IE , fileObj.files[0].fileSize:chrome, fileObj.files[0].size:FF
var size = img1.fileSize || fileObj.files[0].fileSize || fileObj.files[0].size;
alert(size);
}
</script>
<body>
<INPUT TYPE="file" NAME="file" SIZE="30" onchange="getFileSize(this)">
<img id='img1' dynsrc=''/>
</body>
</html>