diff --git a/application/utils.inc.php b/application/utils.inc.php index 66c08e51d..f926b2c3f 100644 --- a/application/utils.inc.php +++ b/application/utils.inc.php @@ -2499,15 +2499,17 @@ SQL; $aHeaders = static::ParseHeaders($http_response_header); $sMimeType = array_key_exists('Content-Type', $aHeaders) ? strtolower($aHeaders['Content-Type']) : 'application/x-octet-stream'; // Compute the file extension from the MIME Type - foreach($aKnownExtensions as $sExtValue => $sMime) - { - if ($sMime === $sMimeType) - { + foreach ($aKnownExtensions as $sExtValue => $sMime) { + if ($sMime === $sMimeType) { $sExtension = '.'.$sExtValue; break; } } } + $sPathName = pathinfo($sPath, PATHINFO_FILENAME); + if (utils::IsNotNullOrEmptyString($sPathName)) { + $sFileName = $sPathName; + } $sFileName .= $sExtension; } $oUploadedDoc = new ormDocument($sData, $sMimeType, $sFileName);