Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

How can I get file size values?

Without Triggering Download



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

10+ Year Member

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?


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

10+ Year Member

use the function -> filesize(string filename)


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

WebmasterWorld Senior Member 10+ Year Member

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:


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

10+ Year Member

the ftp functions might also work.
have a look at ftp_size:


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

10+ Year Member

thanks crypto, thats percicely what I was looking for.

Featured Threads

Hot Threads This Week

Hot Threads This Month