Some users are uploading .msg files to a folder. I need to be able to open it up in a separate window or just open the original file.
I can open everything that I allow, just not .msg files.
Here is the code I'm using to display and download:
<?php
function listFolderFiles($dir){
$ffs = scandir($dir);
foreach($ffs as $ff){
if($ff != '.' && $ff != '..'){
if(is_dir($dir.'/'.$ff)){
// just displaying headers here
}
else{
$filesize = filesize($dir . '/' . $ff);
echo "<a download href='$dir/$ff'>$ff</a>";
}
}
}
echo "<br />";
}
listFolderFiles('files');
?>
Not sure if I should post the code I use to upload, but I did include the .msg extension, and the user is indeed able to upload .msg files.
I found this post: display .msg file in browser using php
And the answer there advised to use various HEADERS. But I'm not sure why I should place the code for the headers.