Question: How do I get files located in Storage?

I build a route and directed it to `myCcontroller@myMethod`. Method is below

```
public function myMethod()
{
    $validPath = 'valid-path-inside-local-storage';
    $file = Storage::disk(env('STORAGE_TO_USE','local'))->get($validPath);
    return $file;
}

```

But I get gibberish, probably raw data. How do I get the browser to display image if file is image or download it if file is, say, `a.xls`?

Answer: 
```
    $validPath = 'valid-path-inside-local-storage';
    $mimeType = Storage::mimeType($validPath);
    $file = Storage::disk(env('STORAGE_TO_USE','local'))->get($validPath);
    return (new Response($file, 200))
        ->header('Content-Type', $mimeType);

```

I hope I didn't miss anything.
For your route define this:

```
Route::get('docs/{file}', 'DocumentController@getDoc');

```

And this your controller

```
class DocumentController extends BaseController
{
    public function getDoc($file){
      $path = 'pathToDirectory/'.$file;
      if(Storage::disk('yourDisk')->exists($path)){
        $attachment = Storage::disk('yourDisk')->get($path);
        $type = Storage::disk('yourDisk')->mimeType($path);
        return Response::make($attachment, 200)->header("Content-Type", $type);
      }else{
        return Response::json('This file does not exists.');
      }
    }
}

```