Download Script Problem??help

Discussion in 'PHP' started by imchandan, Aug 28, 2008.

  1. #1
    Hi All,
    My files are located on another server(hotlinkfiles.com). from my site when you click on download, files get downloaded from another server, but visitor is not aware of. they think that they are downloading from same site.

    while downloading from my site, it doesn't say the file size, i have changed the header("Content-Length :" to exect value also, but doesn't work.
    below is the script i am using :-
    //$file_sizee = check_file_size($id);
    $file_sizee = 680960; //for a particular file
    header("Pragma: public");
    header("Expires: 0");
    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    header("Cache-Control: public");
    header("Content-Description: File Transfer");
    header("Content-Type: application/force-download");
    header("Content-Disposition: attachment; filename=\"$asfname\"");
    header("Content-Transfer-Encoding: binary");
    header("Content-Size: " . $file_sizee);
    $remote = "http://www.hotlinkfiles.com/files/".$id;
    $local = $id;
    $cp = curl_init($remote);
    $fp = fopen($local, "w");

    curl_setopt($cp, CURLOPT_FILE, $fp);
    curl_setopt($cp, CURLOPT_HEADER, 0);
    curl_exec($cp);
    curl_close($cp);
    fclose($fp);


    any help is really appreciated.
    Thanks,
    Chandan
     
    imchandan, Aug 28, 2008 IP
  2. imchandan

    imchandan Guest

    Messages:
    50
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #2
    is there a download script in php or curl which will let my visitors download files(which actually resides on some other hotlink remote server).....
     
    imchandan, Aug 28, 2008 IP