File upload control size
hi,
i want to get the size of upload file using js.
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Blocked AccountRank #403 · 6.2K reputationPosted Nov 24, 2008, 8:06 PM EST
Hi,
This code is for those people who are using ActiveX object and knows that browser will support the below script.
<script language=”javascript” type=”text/javascript”>
var objFSO ;
try
{
objFSO = new ActiveXObject(“Scripting.FileSystemObject”);
}
catch(err)
{
alert(err.message);
alert(err.number);
}
function CheckExtention(el) // pass Upload File object’s ClientID here
{
var myel= document.getElementById(el);
var file;
var path = myel.value;
//alert(path);
file = objFSO.getFile(path);
var size;
size = file.size ; // This size will be in Bytes
// We are converting it to KB as below
alert(‘File Size is : ‘ + file.size /1024 +‘ KB’);
}
script>