示例#1
0
 /**
  * Move an uploaded file from the /tmp directory of the local filesystem
  * to the configured location
  *
  * @param Symfony\Component\HttpFoundation\File\UploadedFile $file 
  * @return string $url A URL to to the file, resolveable in HTML
  */
 public function moveUpload(UploadedFile $file)
 {
     // Nest the uploaded file into unique sub directory and a unqiue name
     $path = $this->makeNestedAndUniquePath($file->getClientOriginalName());
     // Move the uploaded file to the destination using Flysystem and return
     // the new path
     $this->manager->move('tmp://' . $file->getFilename(), 'disk://' . $path);
     // Return the URL of the upload.
     return $this->helpers->url($path);
 }
示例#2
0
文件: Upchuck.php 项目: bkwld/cloner
 /**
  * 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);
 }