Thread: FIle download

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2000
    Posts
    7
    Rep Power
    0
    Hi,

    I'm looking for a way to download a File by specifying the exact URL, and then query the file size. Is this possible?

    Thanks,

    Will
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Posts
    31
    Rep Power
    15
    This is for ascii files only (and I'm not sure if the size is still even close to right):

    $url="http://www.blah.com";
    print strlen( implode("n", file($url)) ) ." ";

    If you want to do it for binary try something like:

    $url="http://www.blah.com";
    $fd=fopen($url,"r");
    // dump fread($fd,insert_maximum_size_here) to a temp file
    fclose($fd);
    print filesize("tempfilename");

Similar Threads

  1. Pointer problem in opening a file
    By LAKI in forum C Programming
    Replies: 13
    Last Post: February 11th, 2004, 09:27 AM
  2. Pointer problems opening file *formatted*
    By LAKI in forum C Programming
    Replies: 4
    Last Post: February 11th, 2004, 07:06 AM
  3. PHP file upload script trouble
    By casbboy in forum PHP Development
    Replies: 9
    Last Post: February 5th, 2004, 08:42 PM
  4. php-sql file upload and download
    By mthroesch in forum PHP Development
    Replies: 0
    Last Post: January 28th, 2004, 02:56 AM

IMN logo majestic logo threadwatch logo seochat tools logo