/** * Duplicate a file given it's URL * * @param string $url * @return string */ public function duplicate($url) { // Make the destination path $current_path = $this->helpers->path($url); $filename = basename($current_path); $dst_disk = $this->disks ? $this->disks->getFilesystem('dst') : $this->disk; $new_path = $this->storage->makeNestedAndUniquePath($filename, $dst_disk); // Copy, supporting alternative destination disks if ($this->disks) { $this->disks->copy('src://' . $current_path, 'dst://' . $new_path); } else { $this->disk->copy($current_path, $new_path); } // Return the Upchuck URL return $this->helpers->url($new_path); }
/** * Delete an upload * * @param string $url A URL like was returned from moveUpload() * @return void */ public function delete($url) { // Convert to a path $path = $this->helpers->path($url); // Delete the path if it still exists if ($this->manager->has('disk://' . $path)) { $this->manager->delete('disk://' . $path); } }