View Full Version : Get Filesize Question
Titan85
02-12-2007, 01:21 AM
I am attempting to get the filesize of a file not in the same directory as the page I am trying to get it from. I get an error each time I try to do this, but when I put the file in the same directory, it works fine. Does filesize() not support an http://url type of path. If not, is there any way I will be able to get the filesize? Thanks in advance
mburt
02-12-2007, 01:29 AM
It has to be in your server configuration. Type in phpinfo(); to see your specs.
Titan85
02-12-2007, 01:33 AM
It has to be in your server configuration. Type in phpinfo(); to see your specs.What needs to be done? I have the specs, but have no idea what to do with the info. Only thing I see that could be an issue is "Virtual Directory Support: disabled". Could that be it?
mburt
02-12-2007, 01:46 AM
"allow_url_fopen" has to be "on"
Titan85
02-12-2007, 01:49 AM
"allow_url_fopen" has to be "on"Its set to on. Could it be something else?
mburt
02-12-2007, 01:54 AM
Could you show the script? (I just tested filesize(), it returns in bytes) I'm not sure what could be wrong...
mburt
02-12-2007, 01:56 AM
Nevermind... it doesn't work for me either. I think it doesn't accept the http protocol.
mburt
02-12-2007, 02:02 AM
After thinking it over, if you have URL file-acces enabled, you can use this script:
echo strlen(file_get_contents("http://filename"));
Each letter is read as a byte.
Ugh, that's hideous.
Do a HEAD request for it and read off the Content-Length.
Titan85
02-12-2007, 04:22 AM
Ugh, that's hideous.
Do a HEAD request for it and read off the Content-Length.How would I go about doing that?
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.