Gestion des fichiers actes et bilans
This commit is contained in:
parent
bd84805c4c
commit
88c04dfa68
@ -86,7 +86,7 @@ class FichierController extends Zend_Controller_Action
|
|||||||
header("Content-Disposition: inline; filename=\"$file\"");
|
header("Content-Disposition: inline; filename=\"$file\"");
|
||||||
print file_get_contents($directory.'/'.$file);
|
print file_get_contents($directory.'/'.$file);
|
||||||
}else{
|
}else{
|
||||||
print "Une erreur c'est produite lors de l'affichage du fichier.";
|
echo "Erreur lors de l'affichage du fichier.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,7 +95,23 @@ class FichierController extends Zend_Controller_Action
|
|||||||
*/
|
*/
|
||||||
public function pdfAction()
|
public function pdfAction()
|
||||||
{
|
{
|
||||||
|
$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/configuration.ini', 'path');
|
||||||
|
$directory = realpath($config->data).'/'.$config->pdf;
|
||||||
|
$file = $this->getRequest()->getParam('fichier');
|
||||||
|
$output_file = $directory.'/'.$file;
|
||||||
|
if (file_exists($output_file) && filesize($output_file)>0) {
|
||||||
|
$content_type = 'application/pdf';
|
||||||
|
header('Content-type: '.$content_type.'');
|
||||||
|
header('Content-Length: '.filesize($output_file));
|
||||||
|
header('Content-MD5: '.base64_encode(md5_file($output_file)));
|
||||||
|
header('Content-Disposition: inline; filename="'.basename($output_file).'"');
|
||||||
|
header('Cache-Control: private, max-age=0, must-revalidate');
|
||||||
|
header('Pragma: public');
|
||||||
|
ini_set('zlib.output_compression','0');
|
||||||
|
echo file_get_contents($output_file);
|
||||||
|
} else {
|
||||||
|
echo "Erreur lors de l'affichage du fichier.";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user