title: download file from a folder using php
body: <p>I need to download csv file from <code>export</code> folder which is inside the <code>www</code> folder.<br>
  I could make it as link, but by attempting to save as the csv files, an empty csv file will be downloaded. Any idea?</p>
  
  <pre><code>&lt;?php
  $dir_open = opendir('./export');
  
  while(false !== ($filename = readdir($dir_open))){
  if($filename != "." &amp;&amp; $filename != ".."){
      $link = "&lt;a href='./$filename'&gt; $filename &lt;/a&gt;&lt;br /&gt;";
  
      echo $link;
  }
  }
  closedir($dir_open);
  ?&gt;
  </code></pre>
  
  <p>the result links are like:<br>
  <a href="https://i.stack.imgur.com/ZAHm5.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZAHm5.jpg" alt="enter image description here"></a></p>
  
  <p>by right clicking and selecting save link as, an empty csv file is downloaded</p>