title: using the browser prompt to download a file
body: <p>I have a php/mysql site in which I am trying to download a comma delimited file (CSV). The csv file I create contains comma delimited data (name, address, city, state). I create the csv file ok and place it in the site's /downloads directory. So far so good. I have been looking on line and the code to trigger the browser's download prompt that I see the most often is:</p>
  
  <pre><code>$path = $_SERVER['DOCUMENT_ROOT'];
  $exportfile = "emailclientaddresses.csv";
  $fullpath = "downloads/" . $exportfile;
  header("Content-type: text/plain");
  header("Content-Length: ".filesize($exportfile));
  header("Content-Disposition: attachment; filename=" . $fullpath);
  </code></pre>
  
  <p>The $exportfile is the csv file that my code created. It's ok. What this does is:</p>
  
  <ol>
  <li>The $fullpath is displayed in the browser download prompt in a very weird format: download_emailclientaddresses.csv</li>
  <li>When it does download, the current webpage is downloaded or a combination of the csv file and the current web page.</li>
  </ol>
  
  <p>OK, I have tried a lot of things and nothing has worked. So, if anyone can help me I would appreciate it. Thank you.</p>
  
  <p>ed Cohen</p>