PDA

View Full Version : [PHP] Devo forzare l'apertura/la spedizione di un PDF: uso readfile ma vien gił rotto


Matrixbob
05-05-2011, 10:47
$web_path_file = 'http://' . $_SERVER["SERVER_NAME"] . '/nomecartella/upload/prodotti_rcp/' . $file;
$relative_path_file = 'upload/prodotti_rcp/' . $file;

if (file_exists($relative_path_file)) {
header('Content-Description: File Transfer');
header('Content-Type: application/pdf');
//header("Content-Disposition: inline; filename=$relative_path_file");
header('Content-Disposition: attachment; filename='.basename($relative_path_file));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($relative_path_file));
ob_clean();
flush();
readfile($relative_path_file);
exit;
}
else {
print "FILE RCP INESISTENTE";
exit;
}

Matrixbob
05-05-2011, 11:06
http://img851.imageshack.us/img851/6232/immaginejl.png

Matrixbob
06-05-2011, 14:14
Alla fine non funzionava solo con Opera, con ff e ie si ... :boh: