Reputation: 1
<?php
$file = SEVENCE_DATA_ROOT."/resource/devdemo/promo_card.tiff";
header('Content-Description: File Transfer');
header('Content-type: application/tiff');
header("Content-Type: application/force-download");// some browsers need this
header("Content-Disposition: attachment; filename=promo_card.tiff");
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
ob_clean();
flush();
readfile($file);
exit;
?>
My issue is that the download image can't be viewed. Can anyone help me with this issue?
Upvotes: 0
Views: 173
Reputation: 32260
Content-Type: application/force-download");// some browsers need this
No browser does need this. It's a dirty glitch..
Reasons why your file cannot be opened:
You have a space or invisible characters at the beginning of your script
the path you are loading the file from might be wrong and it doesn't even read from it (what size is the downloaded file?)
the file simply is corrupt
you don't have a tiff
-viewer
The correct mime type is image/tiff
(instead of application/tiff
)
Upvotes: 1