I'm getting some pictures paths via a webservice this way :
0 => string '/home/41/38/58/96/photos/1.jpg'
1 => string '/home/41/38/58/96/photos/2.jpg'
2 => string '/home/41/38/58/96/photos/3.jpg'
I'm trying to download them to the browser via a PHP script :
foreach($files as $index => $files){
if($index !== 'debug'){
$file_name = basename($file);
$final_file = @fopen($file,"rb");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Pragma: public");
header("Content-Type: image/jpeg");
header('Content-Description: File Transfer');
header("Content-Disposition: attachment; filename=\"$file_name\"");
header('Content-Transfer-Encoding: binary');
header('Content-Length: '.filesize($file));
print(@fread($final_file, filesize($file)));
ob_flush();
flush();
@fclose($final_file);
}
}
The problem is that i'm getting just one picture even if my array contains the three links like you see. So what i'm doing wrong.