title: Reading files with PHP - fopen/fread
body: <pre><code>&lt;?php
  
  $top = "../top.txt";
  $middle = "../middle.txt";
  $bottom = "../bottom.txt";
  $end = "/st.txt";
  $data = "/dt.txt";
  
  $handle1 = fopen($top, "r"); 
  $contents1 = fread($handle1, filesize($top)); 
  fclose($handle1); 
  
  $handle2 = fopen($end, "r"); 
  $contents2 = fread($handle2, filesize($end)); 
  fclose($handle2);
  
  $handle3 = fopen($middle, "r"); 
  $contents3 = fread($handle3, filesize($middle)); 
  fclose($handle3);
  
  $handle4 = fopen($data, "r"); 
  $contents4 = fread($handle4, filesize($data)); 
  fclose($handle4);
  
  $handle5 = fopen($bottom, "r"); 
  $contents5 = fread($handle5, filesize($bottom)); 
  fclose($handle5);
  
  echo $contents1;
  echo $contents2;
  echo $contents3;
  echo $contents4;
  echo $contents5;
  
  ?&gt;
  </code></pre>
  
  <p>I get these errors for every one of them:</p>
  
  <p><em>Warning: fopen(../top.txt) [function.fopen]: failed to open stream: No such file or directory</em></p>
  
  <p><em>Warning: filesize() [function.filesize]: stat failed for ../top.txt</em></p>
  
  <p><em>Warning: fread(): supplied argument is not a valid stream resource</em></p>
  
  <p><em>Warning: fclose(): supplied argument is not a valid stream resource</em></p>
  
  <p>CHMOD in all files and folders and is set to 777</p>
  
  <p>All the files exist on the server</p>
  
  <p>PHP5 is installed on the server</p>
  
  <p>What am i doing wrong?</p>