Weedpacket;10904276 wrote:
Download the file using ftp.
Save its contents in a temporary file.
Read the file size of the temporary file and output it in the headers.
Output the contents of the temporary file.
So to get this straight...lol something like this:
$temp = tmpfile();
$ftp = ftp_connect('ftp.bfgamerz.com') or die('Could not connect to FTP.');
ftp_login($ftp,"*****","*****") or die('Login failed.');
ftp_get($ftp, $temp, ROOT . DIR_DOWNLOADS . $cat .'/' . $Downloads->getFile($_GET['id']), FTP_BINARY);
ftp_close($ftp);
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Description: File Transfer");
header("Pragma: public");
header("Expires: 0");
header('Content-Type: '.$mime.'');
header('Content-Disposition: attachment; filename="'.basename($source).'"');
header('Content-Length: '.filesize(ROOT . DIR_DOWNLOADS . $cat .'/' . $Downloads->getFile($_GET['id'])).'');
header('Content-Transfer-Encoding: binary');
@readfile($temp);
I also tried this as well, no go:
$ftp = ftp_connect('ftp.bfgamerz.com') or die('Could not connect to FTP.');
$login = ftp_login($ftp,"*****","*****") or die('Login failed.');
$temp = tmpfile();
ftp_chdir($ftp,ROOT . 'downloads/'.$cat.'/');
if($login){
ftp_fget($ftp, $temp, $Downloads->getFile($_GET['id']), FTP_BINARY);
} else {
die('Login failed.');
}
ftp_close($ftp);
@readfile($temp);
fclose($temp);
Which returns the following:
Warning: ftp_chdir() [function.ftp-chdir]: Can't change directory to /home/bgallz/public_html/downloads/patches/: No such file or directory in /home/bgallz/public_html/download_file.php on line 30
Warning: ftp_fget() [function.ftp-fget]: Can't open bfv_incr_patch_v1.2_to_v1.21.exe: No such file or directory in /home/bgallz/public_html/download_file.php on line 33
? lol I'm trying here. 😛