This is a discussion on Filesize problem within the PHP Language forums, part of the PHP Programming Forums category; Hi - I need to extract the filesize from some files on the webserver. The directory structure is like this Root - ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi - I need to extract the filesize from some files on the webserver.
The directory structure is like this Root - Public_html - Downloads - Includes All the files I want the size of are in Downloads The php files are in Public_Html and the includes are in Includes. A PHP file calls a file in Includes which tries to get the size of a file in Downloads. I am a bit unclear how to structure the file reference for the Filesave function. It only works if I put the script itself in Downloads and run it from there. In that case I've got filesize("./filename.doc"); any bright ideas? Many thanks |
|
|||
|
On 8 Feb 2005 09:42:20 -0800
steve.burgess@boston-spa.org.uk wrote: > Hi - I need to extract the filesize from some files on the > webserver. > > The directory structure is like this > > Root > - Public_html > - Downloads > - Includes > > All the files I want the size of are in Downloads > > The php files are in Public_Html and the includes are in > Includes. > > A PHP file calls a file in Includes which tries to get the size > of a file in Downloads. > > I am a bit unclear how to structure the file reference for the > Filesave function. > > It only works if I put the script itself in Downloads and run > it from there. > > In that case I've got > > filesize("./filename.doc"); > > any bright ideas? If you script runs from public_html/, then the correct path is Downloads/filename.doc. Even if you include code from Includes/, it doesn't change the path, AFAIK. You can use the absolute path as well... but I think that it will only complicate matters. Also, a function instead of a include may serve you better... you can pass the path to the function and write some code there to handle the path better. If you are having these problems because sometimes you run code from one directory and sometimes you wanna run the same code from another directory... then re-think your structure of files/dirs. |
|
|||
|
*** steve.burgess@boston-spa.org.uk escribió/wrote (8 Feb 2005 09:42:20
-0800): > It only works if I put the script itself in Downloads and run it from > there. > > In that case I've got > > filesize("./filename.doc"); > > any bright ideas? You haven't told us what you do and how it fails. -- -+ Álvaro G. Vicario - Burgos, Spain +- http://www.demogracia.com (la web de humor barnizada para la intemperie) ++ Manda tus dudas al grupo, no a mi buzón -+ Send your questions to the group, not to my mailbox -- |