Results 1 to 10 of 10

Thread: Get Filesize Question

  1. #1
    Join Date
    Aug 2006
    Location
    Ohio
    Posts
    266
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Get Filesize Question

    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
    Thanks DD, you saved me countless times

  2. #2
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    It has to be in your server configuration. Type in phpinfo(); to see your specs.
    - Mike

  3. #3
    Join Date
    Aug 2006
    Location
    Ohio
    Posts
    266
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by mburt View Post
    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?
    Thanks DD, you saved me countless times

  4. #4
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    "allow_url_fopen" has to be "on"
    - Mike

  5. #5
    Join Date
    Aug 2006
    Location
    Ohio
    Posts
    266
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by mburt View Post
    "allow_url_fopen" has to be "on"
    Its set to on. Could it be something else?
    Thanks DD, you saved me countless times

  6. #6
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Could you show the script? (I just tested filesize(), it returns in bytes) I'm not sure what could be wrong...
    - Mike

  7. #7
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Nevermind... it doesn't work for me either. I think it doesn't accept the http protocol.
    - Mike

  8. #8
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    After thinking it over, if you have URL file-acces enabled, you can use this script:

    Code:
    echo strlen(file_get_contents("http://filename"));
    Each letter is read as a byte.
    - Mike

  9. #9
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Ugh, that's hideous.

    Do a HEAD request for it and read off the Content-Length.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  10. #10
    Join Date
    Aug 2006
    Location
    Ohio
    Posts
    266
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Twey View Post
    Ugh, that's hideous.

    Do a HEAD request for it and read off the Content-Length.
    How would I go about doing that?
    Thanks DD, you saved me countless times

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •