Filesize problem

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 - ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-08-2005
steve.burgess@boston-spa.org.uk
 
Posts: n/a
Default Filesize problem

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

Reply With Quote
  #2 (permalink)  
Old 02-08-2005
Kevin
 
Posts: n/a
Default Re: Filesize problem

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.
Reply With Quote
  #3 (permalink)  
Old 02-08-2005
Alvaro G. Vicario
 
Posts: n/a
Default Re: Filesize problem

*** 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
--
Reply With Quote
  #4 (permalink)  
Old 02-08-2005
steve.burgess@boston-spa.org.uk
 
Posts: n/a
Default Re: Filesize problem

Thanks so much.

Problem solved.

Steve

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 10:19 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0