filesize

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John

    filesize

    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

    #2
    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
    Free PHP Classes and Objects 2025 Versions with PHP Example Scripts, PHP Tutorials, Download PHP Scripts, PHP articles, Remote PHP Jobs, Hire PHP Developers, PHP Book Reviews, PHP Language OOP Materials


    PHP Reviews - Reviews of PHP books and other products


    Metastorage - Data object relational mapping layer generator

    Comment

    • iuz

      #3
      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_w hich_i_want_to_ get_the_size.ph p");

      --
      iuz-lab.info is your first and best source for all of the information you’re looking for. From general topics to more of what you would expect to find here, iuz-lab.info has it all. We hope you find what you are searching for!

      Comment

      • Simon Stienen

        #4
        Re: filesize

        John <john@nospam.or g> 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.ne t> <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

        Comment

        • John

          #5
          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


          Comment

          • John

            #6
            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_w hich_i_want_to_ get_the_size.ph p");
            >
            > --
            > 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


            Comment

            • Simon Stienen

              #7
              Re: filesize

              John <john@nospam.or g> 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.ne t> <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

              Comment

              Working...