[MANTIS 21846] When output document is set to "Open the file" once click on the generated file link, the downloaded output document have an incorrect name.
This commit is contained in:
dheeyi william
2017-01-19 10:27:02 -04:00
parent 4c5ad018ae
commit 8a065356ea

View File

@@ -1232,8 +1232,10 @@ class G
case 'txt': case 'txt':
G::sendHeaders( $filename, 'text/html', $download, $downloadFileName ); G::sendHeaders( $filename, 'text/html', $download, $downloadFileName );
break; break;
case 'doc':
case 'pdf': case 'pdf':
G::sendHeaders( $filename, 'application/pdf', $download, $downloadFileName );
break;
case 'doc':
case 'pm': case 'pm':
case 'po': case 'po':
G::sendHeaders( $filename, 'application/octet-stream', $download, $downloadFileName ); G::sendHeaders( $filename, 'application/octet-stream', $download, $downloadFileName );
@@ -1283,12 +1285,14 @@ class G
{ {
if ($download) { if ($download) {
if ($downloadFileName == '') { if ($downloadFileName == '') {
$aAux = explode( '/', $filename ); $aAux = explode('/', $filename);
$downloadFileName = $aAux[count( $aAux ) - 1]; $downloadFileName = $aAux[count($aAux) - 1];
} }
header( 'Content-Disposition: attachment; filename="' . $downloadFileName . '"' ); header('Content-Disposition: attachment; filename="' . $downloadFileName . '"');
} else {
header('Content-Disposition: inline; filename="' . $downloadFileName . '"');
} }
header( 'Content-Type: ' . $contentType ); header('Content-Type: ' . $contentType);
//if userAgent (BROWSER) is MSIE we need special headers to avoid MSIE behaivor. //if userAgent (BROWSER) is MSIE we need special headers to avoid MSIE behaivor.
$userAgent = strtolower( $_SERVER['HTTP_USER_AGENT'] ); $userAgent = strtolower( $_SERVER['HTTP_USER_AGENT'] );