title: how to access file from outside root directory in php
body: <p>I have a code to download zip files:</p>
  
  <pre><code>$dl_path = './';  
  $filename = 'favi.zip';  
  $file = $dl_path.$filename; 
  if (file_exists($file))  {
    header('Content-Description: File Transfer');
    header('Content-Type: application/zips');     
    header("Pragma: public");     
    header("Expires: 0");     
    header("Cache-Control:must-revalidate, post-check=0, pre-check=0"); 
    header("Content-Type:application/force-download");    
    header("Content-Type:application/download");  
    header("Content-Disposition:attachment;filename=$filename ");     
    header("Content-Transfer-Encoding:binary ");
    header('Content-Length: ' . filesize($file));
    ob_clean();
    flush();
    readfile($file);
    exit;
  }
  </code></pre>
  
  <p>there is root directory <code>/public_html</code>, the script is executing in root directory.</p>
  
  <p>there is zip file in <code>/</code> directory. </p>
  
  <p>i am trying to use the <code>$dl_path</code> as <code>/</code> but it is not working.</p>
  
  <p>Please help.</p>