diff --git a/vas/rest/class/vmlib/files/Files_common.class.inc b/vas/rest/class/vmlib/files/Files_common.class.inc index cd8431f26e52d596761db98e7663b24c5130cc6e..4e2ee795f0d83814e81a58c580273765c14671b4 100644 --- a/vas/rest/class/vmlib/files/Files_common.class.inc +++ b/vas/rest/class/vmlib/files/Files_common.class.inc @@ -17,9 +17,8 @@ abstract class Files_common { *@return Retourne une chaine. */ public function extension($sPath) { - $aTemp = explode(".", $sString); + $aTemp = explode(".", $sPath); $sString = strtolower($aTemp[count($aTemp) - 1]); - return $sString; } diff --git a/vas/rest/class/vmlib/files/Files_manager.class.inc b/vas/rest/class/vmlib/files/Files_manager.class.inc index 0f8e79dc60719e1fe652e3f2e4b7815bab08d7c6..923aa8af60e107d269851a4030f81a43b1525d7d 100644 --- a/vas/rest/class/vmlib/files/Files_manager.class.inc +++ b/vas/rest/class/vmlib/files/Files_manager.class.inc @@ -99,16 +99,12 @@ class Files_manager{ return $sErrorMsg; } - $aTemp = explode("/", $sServerPath); - - $sFileName = end($aTemp); + $sFileName = $this->getFileName($sServerPath); $sFileExtension = $this->extension($sFileName); - if (!in_array($sFileExtension, $aForbiddenExtension)) { //Teste si le fichier correspont au format voulu. $bAllowUpload = false; $sFormat = ""; - if (in_array($sFileType, array_keys($aExtension))){ if (in_array($sFileExtension, $aExtension[$sFileType])) { $bAllowUpload = true;