title: PHP force download, download without naming the file the full path name
body: <p>So our system works by storing user images in in user folders, user folders are stored in master user folders which are stored in one folder called client_folders. </p>
  
  <p>Everytime I try to build our download script (using php force download) the files that get downloaded with the name of the entire file path </p>
  
  <p>Example: client_folder/user_30/client_130/image.jpg </p>
  
  <p>I just want the file to say image.jpg</p>
  
  <p>I have tried several things, explode with array pop, basename() but everytime I try one of these options the variable that the readfile() function reads is empty. </p>
  
  <p>Now in mysql I am storing the entire file path (file name included) in one column, is this the right way to do this? and how to do I download files without the entire path </p>
  
  <p>if it helps this is the code that successfully downloads....just with the full path name :(</p>
  
  <pre><code>ob_clean();
  if(isset($_POST['file_name'])){
  $file = $_POST['file_name'];
  header("Content-type: application/octet-stream");
  header('Content-Disposition: attachment; filename="'.$file.'"');
  readfile($file);
  exit();
  }
  </code></pre>