Js gets sample code for uploading file sizes
- 2020-03-30 02:36:48
- OfStack
The code is as follows:
Under ie, it looks like you're going to change the [initialize and execute for ActiveX space marked as a secure executable script] item in the security Settings
<html>
<head>
<script type="text/javascript">
var isIE = /msie/i.test(navigator.userAgent) && !window.opera;
function fileChange(target) {
var fileSize = 0;
if (isIE && !target.files) {
var filePath = target.value;
var fileSystem = new ActiveXObject("Scripting.FileSystemObject");
var file = fileSystem.GetFile (filePath);
fileSize = file.Size;
} else {
fileSize = target.files[0].size;
}
alert( "File byte size : " +fileSize);
var size = fileSize / 1024;
if(size>10000){
alert(" Attachment must not be greater than 10M");
}
}
</script>
</head>
<body>