Hi,
I am running PHP on IIS 6 with mssql. I have uploaded a file to my webserver through a php script. Upon checking the file on the server the file is ok and not corrupt. However, when i then have a link on my website to try and download the file, it says the file is corrupt.
I know the file isnt corrupt as i can view it perfectly if i look at the file on the server.
Is seems like this is a common problem as a similar problem was posted here:
http://www.bigresource.com/Tracker/Track-php-1pAakBhT/
Any help would be much appreciated.
Thanks,
M
My download code is as follows:
$filesize = $rows->filesize;
$filepath = $rows->filepath;
header("Content-Disposition: attachment; filename=$filename");
header("Content-length: $filesize");
header("Content-type: application/pdf");
header("Cache-control: must-revalidate");
header("Content-Description: PHP Generated Data");
readfile($filepath);
FIXED: "just make sure you don't have spaces or news lines before and/or after "