title: Cannot remove images from directory
body: <p>I have written these scripts to delete files (image, in fact) in a directory but have the choice to decide which one to delete and view before hand. The <code>view.php</code> script seems to be working fine, however the <code>delete.php</code> doesn't seem to be functioning because the images are not removing.</p>
  
  <p>here are the scripts:</p>
  
  <p>view.php</p>
  
  <pre><code>&lt;?php
      $path  = '../product-uploads/gloves/'; // path for each page
      $files = glob("{$path}*.*"); // Get the files
      $files = array_filter($files, 'is_file'); // Get rid of directories
      $dates = array_map('filectime', $files); // Get the creation times.
      $md5s  = array();
      array_multisort($dates, $files, SORT_NUMERIC); // in order of creation
  
  
      foreach ($files AS $file)
      {
          $hash = md5_file($file);
          if (!in_array($hash, $md5s))
          {    
              $md5s[] = $hash;
              echo "&lt;img src=\"$file\" /&gt; &lt;br /&gt;
              &lt;form action=\"delete.php\" method=\"post\"&gt;
              &lt;input type=\"hidden\" name=\"Name\" value=\"$file\"&gt;  
              &lt;input type=\"submit\" value=\"Delete\"&gt;
              &lt;/form&gt;";
          }
      }
  ?&gt;
  </code></pre>
  
  <p>delete.php</p>
  
  <pre><code>&lt;?php
      $path = '../product-uploads/gloves/';// images are here
      $Name = $_POST['Name'];
  
      $PathFile = $path.$Name;
      $PathFile = basename($PathFile);
  
      header('Location: view.php');
  ?&gt;
  </code></pre>