title: Creating Zip and Force Downloading - Laravel
body: <p>I am using Laravel 4.2 and am looking to setup an area where a zip file is produced for the user to download.</p>
  
  <p>I keep getting the error </p>
  
  <blockquote>
    <p>The file "myzip.zip does not exist"</p>
  </blockquote>
  
  <p>My current code is :</p>
  
  <pre><code>// Here we choose the folder which will be used.
              $dirName = public_path() . '/uploads/packs/'.$pack_id;
  
              // Choose a name for the archive.
              $zipFileName = 'myzip.zip';
  
              // Create "MyCoolName.zip" file in public directory of project.
              $zip = new ZipArchive;
  
              if ( $zip-&gt;open( public_path() . '/' . $zipFileName, ZipArchive::CREATE ) === true )
              {
                  // Copy all the files from the folder and place them in the archive.
                  foreach ( glob( $dirName . '/*' ) as $fileName )
                  {
                      $file = basename( $fileName );
                      $zip-&gt;addFile( $fileName, $file );
                  }
  
                  $zip-&gt;close();
  
                  $headers = array(
                      'Content-Type' =&gt; 'application/octet-stream',
                  );
  
                  // Download .zip file.
                  return Response::download( public_path() . '/' . $zipFileName, $zipFileName, $headers );
  </code></pre>
  
  <p>Can anyone help me, As to why I am getting the does not exist error?</p>
  
  <p>Thank You!</p>