title: Download a file from command line in laravel artisan
body: <p>I am using laravel Artisan Commands to download a file from public folder .</p>
  
  <p>Actually i want to download a zip file which i have successfully made in public folder.</p>
  
  <p>I am able to download the file when I call the methods on button click. </p>
  
  <p>But when I execute the command in console it does not work and also not throw any error.</p>
  
  <pre><code>public function downloadExportRawData() {
      $a=public_path().'/temp/rawexport/rawexportproduct.zip';
      $path='/temp/rawexport/rawexportproduct.zip';
      if(file_exists('temp/rawexport/rawexportproduct.zip')){
          return Response::download($a);
      }else{
          return "hello";
      }
  }
  </code></pre>
  
  <p>Tried this also...</p>
  
  <pre><code>public static function downloadZip($rand_folder, $zipname, $fileName) {
  
      header('Content-Type: application/force-download');
      header('Content-Disposition: attachment; filename="' . $fileName . '.zip"');
      header('Content-Length: ' . filesize($zipname));
  
      $handle = fopen($zipname, 'rb');
      //exec("rm -r ".$temp);
      while (!feof($handle)) {
          echo fread($handle, 1048576);
          ob_flush();
          flush();
      }
      fclose($handle);
     // exec("rm -r " . $rand_folder);
  }
  </code></pre>
  
  <p>and the command is </p>
  
  <pre><code>php artisan product:export --from=http://localhost/valuable-app/dev-master/rest_app/public/ --productid=5b273b0e4bb5995b108b4576 --tokenexport=354c3ddb2bd45aa6e5c4f749749b0b58cbacef48
  </code></pre>
  
  <p>The main problem is that it is going through the function in controller but not downloading it. 
  And I tried to echo the response it prints code in zip form means a encoded form which have something related to my zip file means its printing the zip not downloading it. 
  I am using Artisan first time. Any idea how to download that file using using user-defined Artisan command. </p>
  
  <p>I am trying this from last two weeks but not able to do anything.</p>