title: Unable to download file from s3 using return response()->download($file);
body: <p>I am uploading files to<code>s3</code> I want it to download securely using following code in my controller, but it's not working. </p>
  
  <p>I am using Laravel 5.5 and files visibility is not public on <code>s3</code>.</p>
  
  <pre><code>if( Storage::disk('s3')-&gt;exists($file_path) ) {
        $file =  Storage::disk('s3')-&gt;get($file_path);
        return response()-&gt;download($file);
  }
  
  abort(404, 'File not found.');
  </code></pre>
  
  <p>It's giving me this error </p>
  
  <pre><code>is_file() expects parameter 1 to be a valid path, string given
  ...
  /home/vagrant/spark-etr/vendor/symfony/http-foundation/File/File.php:36
  #1 /home/vagrant/spark-etr/vendor/symfony/http-foundation/File/File.php(36): is_file('\\xFF\\xD8\\xFF\\xE0\\x00\\x10JFIF\\x00\\x01\\x01\\x00\\x00...')
  #2 /home/vagrant/spark-etr/vendor/symfony/http-foundation/BinaryFileResponse.php(94): Symfony\\Component\\HttpFoundation\\File\\File-&gt;__construct('\\xFF\\xD8\\xFF\\xE0\\x00\\x10JFIF\\x00\\x01\\x01\\x00\\x00...')
  #3 /home/vagrant/spark-etr/vendor/symfony/http-foundation/BinaryFileResponse.php(53): Symfony\\Component\\HttpFoundation\\BinaryFileResponse-&gt;setFile('\\xFF\\xD8\\xFF\\xE0\\x00\\x10JFIF\\x00\\x01\\x01\\x00\\x00...', 'attachment', false, true)
  #4 /home/vagrant/spark-etr/vendor/laravel/framework/src/Illuminate/Routing/ResponseFactory.php(125): Symfony\\Component\\HttpFoundation\\BinaryFileResponse-&gt;__construct('\\xFF\\xD8\\xFF\\xE0\\x00\\x10JFIF\\x00\\x01\\x01\\x00\\x00...', 200, Array, true, 'attachment')
  </code></pre>
  
  <p>The file is on <code>s3</code> since I am checking for exists before downloading.</p>
  
  <h3>Update</h3>
  
  <p>Dumping the <code>$file</code> var gives me binary like this </p>
  
  <p><a href="https://i.stack.imgur.com/nVhXR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nVhXR.png" alt="enter image description here"></a></p>
  
  <p>Please help</p>