title: Laravel 5 zipArchive to Storage vs to public
body: <p>In my Larevel app, I would like to put together some files to a zip file for the client to download. I prefer not to put the zip in the public folder. 
  so I create a "tobedownload" folder in my "/storage" folder and plan to put the zip file there. but I got Whoops error:</p>
  
  <pre><code>"ZipArchive::close(): Failure to create temporary file: No such file or directory"   
  </code></pre>
  
  <p>My sample code is like this: (say, the file needs to be put into zip is "whatever.PNG" in the public folder. No worries, I won't use files in this location in real implementation. the example archive file is named "AllDocuments.zip" itis under storage/tobedownload folder).<br>
        public function downloadzip(){</p>
  
  <pre><code>     Storage::makeDirectory('tobedownload',$mode=0775); 
  
     $path=storage_path('tobedownload');
     $public_dir=public_path();
  
     $zipFileName = 'AllDocuments.zip';
  
  
      $zip=new ZipArchive(); 
  
      if ($zip-&gt;open( $path. '/' .$zipFileName, ZipArchive::CREATE))
      {
          $zip-&gt;addFile($public_dir.'/whatever.PNG' ); //where the file needs to be add to archive
          $zip-&gt;close();
  
      }
  
  }
  </code></pre>
  
  <p>But say, if I put my new zip file in the public folder,I am able to create the zip. the following example code works.<br>
        public function downloadzip(){
         //seems everthing works if I put the archive in the public folder   </p>
  
  <pre><code>   $public_dir=public_path();
  
     $zipFileName = 'AllDocuments.zip';
  
  
      $zip=new ZipArchive(); 
  
      if ($zip-&gt;open( $public_dir. '/' .$zipFileName, ZipArchive::CREATE))
      {
          $zip-&gt;addFile($public_dir.'/whatever.PNG' ); //where the file needs to be add to archive
          $zip-&gt;close();
  
      }
  
  }
  </code></pre>
  
  <p>I suspect it is the permission issue but I already set the storage 0755. Thanks for any helps...  I am on Laravel 5.6.</p>