The code is for downloading excel file(.xls)
<p>Problem:
 After download, the file doesn't contain the data.
 i.e it become blank.</p>

<p>So please help me for this.</p>

<pre><code>&lt;?php

    session_start();
    include_once 'oesdb.php';
    $id=$_REQUEST['id'];

    if(isset($_REQUEST['id']))
    {
      $sql=executeQuery("SELECT * FROM file where id=$id");
      $rows = mysql_fetch_array($sql);
      $file =$rows['file'];


          header('Content-Description: File Transfer');
          header('Content-Type: application/vnd.ms-excel');
          header('Content-Disposition: attachment; filename='.basename($file));
          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('uploads/'.$file);
          exit;

     }
?&gt;
</code></pre>
