From b2d78b90e53e322eb1478361787cdfa686efc115 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillaume=20Perr=C3=A9al?= <guillaume.perreal@irstea.fr> Date: Mon, 26 Jan 2015 15:04:54 +0100 Subject: [PATCH] =?UTF-8?q?UploadedFile:=20nouvelle=20m=C3=A9thode=20moveT?= =?UTF-8?q?o($newDir),=20qui=20permet=20de=20"d=C3=A9placer"=20le=20fichie?= =?UTF-8?q?r=20dans=20un=20nouveau=20r=C3=A9pertoire.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Entity/UploadedFile.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Entity/UploadedFile.php b/Entity/UploadedFile.php index 70b0e051..f4c8d443 100644 --- a/Entity/UploadedFile.php +++ b/Entity/UploadedFile.php @@ -159,6 +159,16 @@ class UploadedFile return $this; } + /** Change le chemin d'un fichier sans changer le nom. + * + * @param string $newDir Nouveau répertoire + * @return UploadedFileInterface + */ + public function moveTo($newDir) + { + $this->setPath(rtrim($newDir, '/') . '/' . pathinfo($this->path, PATHINFO_FILENAME)); + } + /** * Set mimeType * -- GitLab