Welcome visitor
* Login
* Register
It is currently March 18th, 2019, 3:26 pm
All times are UTC [ DST ]
* Search
View unanswered posts - View active topics

FORUMS » Client Side » JavaScript



Post new topic Reply to topic  [ 3 posts ] 
Author Message
  check file size
PostPosted: August 5th, 2009, 5:27 am 

Posts: 23
hi, how can i read the size of a file before it is uploaded from an input type="file"?


Top
 Profile  
 
  Re: check file size
PostPosted: August 5th, 2009, 5:34 am 
User avatar

Posts: 42
you can't. you need to do it server side.


Top
 Profile  
 
  Re: check file size
PostPosted: August 5th, 2009, 5:50 am 

Posts: 21
i found this code on the web, still its going to need approval from the user to run the activeX. anyways, hth
<html>
<head>
<script language="JavaScript">
function A()
{
var oas = new ActiveXObject("Scripting.FileSystemObject");
var d = document.a.b.value;
var e = oas.getFile(d);
var f = e.size;
alert(f + " bytes");
}
</script>
</head>
<body>
<form name="a">
<input type="file" name="b">
<input type="button" name="c" value="SIZE" onClick="A();">
</form>
</body>
</html>


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

FORUMS » Client Side » JavaScript


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron