Connecting Tech Pros Worldwide Forums | Help | Site Map

filesize

John
Guest
 
Posts: n/a
#1: Jul 17 '05
Hi all,

I'd like to evaluate dynamicaly the size of a dynamic file.
I use the filesize() function...

this is my code :
$my_size =
filesize(http://localhost/the_file_from_which...t_the_size.php) ;

=> I always get 0 !
Do you have any solution ?

thanks in advance,

--
john



Manuel Lemos
Guest
 
Posts: n/a
#2: Jul 17 '05

re: filesize


Hello,

On 10/02/2004 03:29 PM, John wrote:[color=blue]
> I'd like to evaluate dynamicaly the size of a dynamic file.
> I use the filesize() function...
>
> this is my code :
> $my_size =
> filesize(http://localhost/the_file_from_which...t_the_size.php) ;
>
> => I always get 0 !
> Do you have any solution ?[/color]

if the page is generated dynamically, the only solution is to retrieve
it and count the number of bytes in it.

--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
iuz
Guest
 
Posts: n/a
#3: Jul 17 '05

re: filesize


John wrote:
[color=blue]
> Hi all,
>
> I'd like to evaluate dynamicaly the size of a dynamic file.
> I use the filesize() function...
>
> this is my code :
> $my_size =
> filesize(http://localhost/the_file_from_which...t_the_size.php)
> ;[/color]
[..][color=blue]
> --
> john[/color]

you forget the '"' and you must declarate the file name in the following
form.. try this..
(if the script is in the same directory of the file you want to examine)
$my_size = filesize("./the_file_from_which_i_want_to_get_the_size.php");

--
www.iuz-lab.info
Simon Stienen
Guest
 
Posts: n/a
#4: Jul 17 '05

re: filesize


John <john@nospam.org> wrote:[color=blue]
> Hi all,
>
> I'd like to evaluate dynamicaly the size of a dynamic file.
> I use the filesize() function...
>
> this is my code :
> $my_size =
> filesize(http://localhost/the_file_from_which...t_the_size.php) ;
>
> => I always get 0 !
> Do you have any solution ?
>
> thanks in advance,[/color]

<http://php.net/filesize> clearly states:
| *Tip:* As of PHP 5.0.0 this function can also be used with /some/ URL
| wrappers. Refer to _Appendix L_ for a listing of which wrappers support
| *_stat()_* family of functionality.

Now Appendix L on HTTP(S) <http://php.net/wrappers.http>:
| Attribute Supported
| Restricted by allow_url_fopen. Yes
| Allows Reading Yes
| Allows Writing No
| Allows Appending No
| Allows Simultaneous Reading and Writing N/A
| Supports stat() No <-- LOOK HERE!
| Supports unlink() No
| Supports rename() No
| Supports mkdir() No
| Supports rmdir() No

A simple RTFM gives the answer... nice, huh?
--
Simon Stienen <http://dangerouscat.net> <http://slashlife.de>
»What you do in this world is a matter of no consequence,
The question is, what can you make people believe that you have done.«
-- Sherlock Holmes in "A Study in Scarlet" by Sir Arthur Conan Doyle
John
Guest
 
Posts: n/a
#5: Jul 17 '05

re: filesize


> <http://php.net/filesize> clearly states:[color=blue]
> | *Tip:* As of PHP 5.0.0 this function can also be used with /some/ URL
> | wrappers. Refer to _Appendix L_ for a listing of which wrappers support
> | *_stat()_* family of functionality.
>
> Now Appendix L on HTTP(S) <http://php.net/wrappers.http>:
> | Attribute Supported
> | Restricted by allow_url_fopen. Yes
> | Allows Reading Yes
> | Allows Writing No
> | Allows Appending No
> | Allows Simultaneous Reading and Writing N/A
> | Supports stat() No <-- LOOK HERE!
> | Supports unlink() No
> | Supports rename() No
> | Supports mkdir() No
> | Supports rmdir() No
>
> A simple RTFM gives the answer... nice, huh?[/color]

I already RTFM... but my Php version is 4.3.8 :-/
anyway, thx for you help.

--
john


John
Guest
 
Posts: n/a
#6: Jul 17 '05

re: filesize


>[color=blue]
> you forget the '"' and you must declarate the file name in the following
> form.. try this..
> (if the script is in the same directory of the file you want to examine)
> $my_size = filesize("./the_file_from_which_i_want_to_get_the_size.php");
>
> --
> www.iuz-lab.info[/color]

The trouble is that the Php file read locally is 3 kb as it is some 8 to 10
kb when interpreted...

--
john


Simon Stienen
Guest
 
Posts: n/a
#7: Jul 17 '05

re: filesize


John <john@nospam.org> wrote:[color=blue][color=green]
>> <http://php.net/filesize> clearly states:
>>| *Tip:* As of PHP 5.0.0 this function can also be used with /some/ URL
>>| wrappers. Refer to _Appendix L_ for a listing of which wrappers support
>>| *_stat()_* family of functionality.
>>
>> Now Appendix L on HTTP(S) <http://php.net/wrappers.http>:
>>| Attribute Supported
>>| Restricted by allow_url_fopen. Yes
>>| Allows Reading Yes
>>| Allows Writing No
>>| Allows Appending No
>>| Allows Simultaneous Reading and Writing N/A
>>| Supports stat() No <-- LOOK HERE!
>>| Supports unlink() No
>>| Supports rename() No
>>| Supports mkdir() No
>>| Supports rmdir() No
>>
>> A simple RTFM gives the answer... nice, huh?[/color]
>
> I already RTFM... but my Php version is 4.3.8 :-/
> anyway, thx for you help.[/color]

Then the first part on its own suffices as your way to enlightment...
--
Simon Stienen <http://dangerouscat.net> <http://slashlife.de>
»What you do in this world is a matter of no consequence,
The question is, what can you make people believe that you have done.«
-- Sherlock Holmes in "A Study in Scarlet" by Sir Arthur Conan Doyle
Closed Thread