For a customer i changed the download.php so that user is asked to download the file (even if it's mp3 or jpg).
Unfortunately this does not work for IE7 (i guess there are problems with the header-data): It displays the dialog "Save file...", downloads an says the download was successfull, but it is'nt because the file is empty.
For IE6 / FF etc. it works.
The code:
in download.php i change this
Code: Select all
headerRedirect(PHPWCMS_URL . PHPWCMS_FILES . $fileinfo['filename']);
Code: Select all
// Set content type
if (preg_match('#Opera(/| )([0-9].[0-9]{1,2})#', getenv('HTTP_USER_AGENT')) or
preg_match('#MSIE ([0-9].[0-9]{1,2})#', getenv('HTTP_USER_AGENT'))) {
$content_type = 'application/octetstream';
} else {
$content_type = 'application/octet-stream';
}
header("Content-Type: ".$content_type);
header( 'Content-Length: ' . $fileinfo['filesize'] );
header( 'Content-Disposition: attachment; filename="'.$download["f_name"].'"' );
readfile(PHPWCMS_FILES . $fileinfo['filename']);
Code: Select all
if (preg_match('#MSIE (7.[0-9]{1,2})#', getenv('HTTP_USER_AGENT'))) {
headerRedirect(PHPWCMS_URL . PHPWCMS_FILES . $fileinfo['filename']); }else{
readfile(PHPWCMS_FILES . $fileinfo['filename']); }
Greetings an cheers,
Metti