By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,747 Members | 1,594 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,747 IT Pros & Developers. It's quick & easy.

getting the size of a file

P: n/a
hi, now i have the next problem. i have some links to files (.zip, .rar...)
and i would like to get its size
could you say me how to do or give me some references???

Thanks
Jul 23 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On Tue, 7 Sep 2004 18:22:04 +0200, Ricardo Garcia wrote:
i would like to get its size
could you say me how to do or give me some references???


<http://google.com/groups?th=ded2c6e9b9dc58c7#link9>

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
Jul 23 '05 #2

P: n/a
Ricardo Garcia wrote:
hi, now i have the next problem. i have some links to files (.zip, .rar...)
and i would like to get its size
could you say me how to do or give me some references???

Thanks


1) Use the XML HTTP Request object available in IE and Gecko-based browsers to
do a HEAD request for the file. The headers that get returned should contain
the file size (Content-Length) <url:
http://jibbering.com/2002/4/httprequest.html />.

2) If you have any sort of server-side technology available to you (ASP, JSP,
Perl, PHP, etc), you could use it to retrieve the size of the file and then
"pass" that value to the client-side javascript:

<?php
# use PHP to determine the size of the file
?>
<script type="text/javascript">
var fileSize = <?php echo $fileSize ?>;
</script>

--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ - http://jibbering.com/faq

Jul 23 '05 #3

P: n/a
http://msdn.microsoft.com/library/de...us/script56/ht
ml/jsprosize.asp
Jimbo
"Ricardo Garcia" <th******@wanadoo.es> wrote in message
news:El*********************@news-reader.eresmas.com...
hi, now i have the next problem. i have some links to files (.zip, ..rar...) and i would like to get its size
could you say me how to do or give me some references???

Thanks

Jul 23 '05 #4

P: n/a

Note: the size you get will be the size at the host. If you transfer
the file to your machine, it may be a slightly different size.

--
RobG

Jul 23 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.