diff --git a/vas/rest/class/vmlib/files/Files_common.class.inc b/vas/rest/class/vmlib/files/Files_common.class.inc
index 4e2ee795f0d83814e81a58c580273765c14671b4..7931ed74419c3a5844e4785cab7548b07bbc284d 100644
--- a/vas/rest/class/vmlib/files/Files_common.class.inc
+++ b/vas/rest/class/vmlib/files/Files_common.class.inc
@@ -17,7 +17,7 @@ abstract class Files_common {
      *@return Retourne une chaine.
      */
     public function extension($sPath) {
-        $aTemp = explode(".", $sPath);
+        $aTemp = explode(".", $sString);
         $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 d4c85083f49e19a360dd671070de173030b5f207..5b9f74380a5d40b0c52aaa2cb21b9c00ee91c667 100644
--- a/vas/rest/class/vmlib/files/Files_manager.class.inc
+++ b/vas/rest/class/vmlib/files/Files_manager.class.inc
@@ -99,25 +99,29 @@ class Files_manager{
                 return $sErrorMsg;
             }
 
-                 $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;
-                         } else {
-                             foreach ($aExtensionPicture as $sValue) {
-                                 $sFormat .= " " . $sValue;
-                             }
-                             writeToErrorLog(ERROR_FILE . $aFileValues['name']  . ERROR_NOT_FILE . $sFileType);
-                             $sErrorMsg = FILE_LABEL_PHPUTIL . $aFileValues['name']  . ERROR_NOT_FILE . $sFileType . ERROR_VALID_FILE . $sFormat . '.';
-                         }
-                     } else {
-                         $bAllowUpload = true;
-                     }
+            $aTemp = explode("/", $sServerPath);
+
+            $sFileName = end($aTemp);
+            $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;
+                    } else {
+                        foreach ($aExtensionPicture as $sValue) {
+                            $sFormat .= " " . $sValue;
+                        }
+                        writeToErrorLog(ERROR_FILE . $aFileValues['name']  . ERROR_NOT_FILE . $sFileType);
+                        $sErrorMsg = FILE_LABEL_PHPUTIL . $aFileValues['name']  . ERROR_NOT_FILE . $sFileType . ERROR_VALID_FILE . $sFormat . '.';
+                    }
+                } else {
+                    $bAllowUpload = true;
+                }
 
                 //Teste si le fichier n'est pas de trop grande taille.
                 if ($aFileValues['size'] > $sMaxSize || $aFileValues['error'] == 1) {