title: ERROR: could not open file - No such file or directory [PHP, PDO]
body: <p>I'm trying to open a file and IMPORT it to PSQL</p>
  
  <pre><code>$sql ="COPY r_vehicle_submodel FROM '".$filePath."' DELIMITER ',' CSV";
  </code></pre>
  
  <p>However it display me error:</p>
  
  <blockquote>
    <p>Fatal error: Uncaught exception 'PDOException' with message
    'SQLSTATE[58P01]: Undefined file: 7 ERROR: could not open file
    "C:\xampp...\uploads\SearchTreeCZ.csv" for reading: No such file or
    directory' in</p>
  </blockquote>
  
  <p>I try to copy this path to clipboard and open file and i open it correctly so file is there for sure.</p>
  
  <p>After that I was thinking if just PHP don't have permission to this file/ folder so I write something really simple:</p>
  
  <pre><code>$file = fopen($filePath,'r');
  echo fread($file,filesize($filePath));  
  </code></pre>
  
  <p>Which open me my file correctly, I also try to scandir this path successfully.</p>
  
  <p><code>echo $filepath</code> display:
  C:\xampp\htdocs\xampp\utilities\searchTreeImport\uploads\SearchTreeCZ.csv</p>
  
  <p>Guys do you have any idea where can be a problem and WHY I can't open this file?</p>
  
  <p>Thanks</p>
  
  <p>EDIT:
  This QUERY works (MySQL)</p>
  
  <pre><code>$sql = "LOAD DATA INFILE '".$filePath."' 
          INTO TABLE r_vehicle_submodel 
          CHARACTER SET UTF8
          FIELDS TERMINATED BY ',' 
          ENCLOSED BY '\"' 
          IGNORE 1 LINES ";   
  </code></pre>
  
  <p>This QUERY doesn't work (PSQL)</p>
  
  <pre><code>$sql ="COPY r_vehicle_submodel FROM '".$filePath."' DELIMITER ',' CSV";
  </code></pre>
  
  <p>So i expect problem can be in my $sql query</p>