/** * @inheritDoc */ protected function doMove($directory, $filename) { if ($this->moved) { return parent::doMove($directory, $filename); } $newPath = $directory . DIRECTORY_SEPARATOR . $filename; if (!move_uploaded_file($this->getPath(), $newPath)) { throw new FileException(sprintf('Could not move file %s to %s', $this->getPath(), $newPath)); } $this->moved = true; $this->path = realpath($newPath); }