diff --git a/web_service/ws/Workspaces.class.inc b/web_service/ws/Workspaces.class.inc index 7db2edfa7184fd9802ecde099225d94996773c8d..0e9a34d296abd5978bb566e2f83e17972c619b6c 100755 --- a/web_service/ws/Workspaces.class.inc +++ b/web_service/ws/Workspaces.class.inc @@ -525,15 +525,12 @@ class Workspaces extends GTF { putFileContentInWsDataDir('gtf', 'workspace', $this->aValues["my_vitis_id"], 'form/ressources', 'Subform.css', ''); // Upload du fichier de ressource. if ($this->aValues["comp_file"] != "") { + // Si le fichier est une archive .zip -> décompression et copie des fichiers. + if (pathinfo($this->aValues["comp_file"], PATHINFO_EXTENSION) == "zip") + unzipInWsDataDir('gtf', 'workspace', $this->aValues["my_vitis_id"], 'fme', $_FILES['comp_file']['tmp_name']); $this->aValues['fme'] = $this->aValues['comp_file']; $_FILES['fme'] = $_FILES['comp_file']; $sErrorMessage = uploadInWsDataDir("gtf", "workspace", $this->aValues["my_vitis_id"], "fme", $this->aValues); - /* - $ext = pathinfo($_FILES['comp_file']['name'], PATHINFO_EXTENSION); - if ($ext == "zip") { - unZip($sDirName . "/fme/" . utf8_decode($_FILES['comp_file']['name']), $sDirName . "/fme/"); - } - */ } // Lit le contenu du fichier .fmw du projet. $sFmwFileContent = getFileContentInWsDataDir("gtf", "workspace", $this->aValues["my_vitis_id"], 'fme', $_FILES['fmw_file']['name']); @@ -828,12 +825,12 @@ class Workspaces extends GTF { if (!empty($this->aValues["comp_file_file"])) { $this->aValues["comp_file"] = $this->aValues["comp_file_name"]; putFileContentInWsDataDir('gtf', 'workspace', $this->aValues["my_vitis_id"], 'fme', $this->aValues["comp_file_name"], $this->aValues["comp_file_file"]); - /* - $ext = pathinfo($_FILES['comp_file']['name'], PATHINFO_EXTENSION); - if ($ext == "zip") { - unZip($sDirName . "/fme/" . utf8_decode($_FILES['comp_file']['name']), $sDirName . "/fme/"); + // Si le fichier est une archive .zip -> décompression et copie du répertoire. + if (pathinfo($this->aValues["comp_file"], PATHINFO_EXTENSION) == "zip") { + $sZipFilePath = $this->aProperties['extract_dir'] . '/' . $this->aValues["comp_file_name"]; + file_put_contents($sZipFilePath, $this->aValues["comp_file_file"]); + unzipInWsDataDir('gtf', 'workspace', $this->aValues["my_vitis_id"], 'fme', $sZipFilePath); } - */ } $aReturn = $this->genericPut($this->aProperties['schema_gtf'], 'workspace', 'workspace_id'); if ($aReturn["sStatus"] == 1) {