daemonkin
03-10-2008, 04:52 PM
Hi guys,
I have the following code that i tailor to suit my needs.
$file = $_SERVER['DOCUMENT_ROOT'] . '/images/gallery/' . $file_name;
$aInfo = explode('.', $file_name);
$type = $aInfo[count($aInfo)-1];
$filename = substr(strrchr($file, '/'), 1);
$content_type = "application/" . $type . "\n";
$attachment = ' attachment; ';
header('Content-Type: ' . $content_type);
header('Content-Transfer-Encoding: binary');
header('Content-Disposition: ' . $attachment . ' filename=' . $filename);
header('Content-Length: ' . filesize($file));
$fn = fopen($file, 'r');
fpassthru($fn);
header('Location: ' . $_SERVER['HTTP_REFERRER']);
exit;
I now need to download multiple files from an array $aImages. However when I run the script it downloads only one file (the first one) and when I do it again it downloads the second etc
Can anyone recommend a solution?
D.
I have the following code that i tailor to suit my needs.
$file = $_SERVER['DOCUMENT_ROOT'] . '/images/gallery/' . $file_name;
$aInfo = explode('.', $file_name);
$type = $aInfo[count($aInfo)-1];
$filename = substr(strrchr($file, '/'), 1);
$content_type = "application/" . $type . "\n";
$attachment = ' attachment; ';
header('Content-Type: ' . $content_type);
header('Content-Transfer-Encoding: binary');
header('Content-Disposition: ' . $attachment . ' filename=' . $filename);
header('Content-Length: ' . filesize($file));
$fn = fopen($file, 'r');
fpassthru($fn);
header('Location: ' . $_SERVER['HTTP_REFERRER']);
exit;
I now need to download multiple files from an array $aImages. However when I run the script it downloads only one file (the first one) and when I do it again it downloads the second etc
Can anyone recommend a solution?
D.