I'm using the typical
if($ext == "doc" && file_exists($file)) {
header("Content-disposition: attachment; filename= '$filename'");
header('Content-type: application/msword');
readfile($file);
}
This serves the files perfectly fine. However when I use:
if($ext == "doc" && file_exists($file)) {
header("Content-disposition: attachment; filename= '$filename'");
header('Content-type: application/vnd.openxmlformats officedocument.wordprocessingml.document');
readfile($file);
}
The downloaded document displays errors when I open it in word indicating it is corrupt. However, if I click forward it opens just fine.
How do I make this corrupt file error not occur.