homepage Welcome to WebmasterWorld Guest from 54.242.231.109
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
How can I get file size values?
Without Triggering Download
Willis




msg:1258901
 5:49 am on Oct 8, 2004 (gmt 0)

Is it possible with PHP to request the size of a file?

Say I had located somewhere on a server "file.zip". Ok sure I could always hardcode the size of that file, but how can I without actually triggering a download determain the size of that file?

 

crypto




msg:1258902
 7:04 am on Oct 8, 2004 (gmt 0)

use the function -> filesize(string filename)

mincklerstraat




msg:1258903
 8:34 am on Oct 8, 2004 (gmt 0)

If it's not on your own server, and you don't have php5, this isn't likely to work (notice the 'url wrapper' note in the manual page - this usually refers to url's of 'remote' files, i.e. files not on your own server). There's a user-contributed note, though, on using curl to do this:
[be2.php.net...]

Adrian2k4




msg:1258904
 7:01 am on Oct 9, 2004 (gmt 0)

the ftp functions might also work.
have a look at ftp_size:
[ch2.php.net...]

Willis




msg:1258905
 11:48 pm on Oct 9, 2004 (gmt 0)

thanks crypto, thats percicely what I was looking for.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved