title: Apk download with php gives undefined but download works after browser refresh
body: <pre><code>&lt;a href="download.php"&gt;&lt;img src="images/android/android01.jpg"/&gt;Android&lt;/a&gt;
  </code></pre>
  
  <p>links to:</p>
  
  <p>php code:</p>
  
  <pre><code>$file = 'myfile.apk';
  $filename ="MYAPP";
  if (file_exists($file)) {
      header('Content-Description: File Transfer');
      header('Content-Type: application/vnd.android.package-archive');
      header("Content-Disposition:attachment; filename=\"$filename\"");
      header('Content-Transfer-Encoding: binary');
      header('Expires: 0');
      header('Cache-Control: must-revalidate');
      header('Pragma: public');
      header('Content-Length: ' . filesize($file));
      ob_clean();
      flush();
      readfile($file);
      exit;
  }
  </code></pre>
  
  <p>I get an undefined output on Firefox desktop browser and phone. When I do a browser refresh, the download dialog starts and downloads the apk file.
  Any ideas on how I can get around the undefined output in a blank page and go to download dialog immediatly?</p>