/** * Move file to another location * * @param string $file Target file * * @return File */ public function copy($file) { if (!$file instanceof self) { $file = new self($file); } $file->getDir()->create(); if (is_uploaded_file($this->path)) { move_uploaded_file($this->path, $file->path); } else { copy($this->path, $file->path); } return $this; }