I have this code:
$bmpblob = file_get_contents($image);
header('Content-type: application/postscript');
header('Content-Disposition: attachment; filename="'.$id1.'.ai"');
echo $bmpblob;
But when I download this file it’s corrupted.
I have similar code for .psd files and it’s working:
$bmpblob = file_get_contents($image);
header('Content-type: image/psd');
header('Content-Disposition: attachment; filename="'.$id1.'.psd"');
echo $bmpblob;
What am I doing wrong?
Ok, I found out what was the matter.
When I opened the file I download in Notepad++, I noticed, that in the end of the file I have:
So thus file was corrupted.
It strange, though, that .psd files had the same on the end and they worked perfectly 🙂