Tuesday, March 20, 2012

Using javascript check uploaded file size for (Internet Explorer)

Note:- Only working with Internet explorer
for FireFox,Crome,Safari,Opera check this page

code is given below:

<html>

<head>
<script>
function getSize()
{
    var myFSO = new ActiveXObject("Scripting.FileSystemObject");
    var filepath = document.upload.file.value;
    var thefile = myFSO.getFile(filepath);
    var size = thefile.size;
    alert(size + " bytes");
}
</script>
</head>
<body>
<form name="upload">
<input type="file" name="file">
<input type="btn" value="Size?" onClick="getSize();">
</form>
</body>
</html>

No comments:

Post a Comment