Exemplo n.º 1
0
 /**
  * Download a file.
  */
 public function downloadFile($path)
 {
     $path = $this->cleanFolder($path);
     $parts = explode('/', $path);
     $filename = array_pop($parts);
     $content = $this->fileSystem->get($path);
     $mime = $this->fileSystem->mimeType($path);
     if (!$this->fileSystem->exists($path)) {
         throw new FileDoesNotExist('File does not exist.');
     }
     return response($content, 200)->header('Content-Type', $mime)->header('Content-Disposition', 'attachment; filename="' . $filename . '"');
 }