title: move_uploaded_file error php won't upload to filepath
body: <p>I'm writing a script to upload user input and images to a place in my file system (currently on a different server).
  I get an error
   move_uploaded_file(images//test.pdf): failed to open stream: Permission denied in   ..</p>
  
  <pre><code>$dbh = new PDO('mysql:host=' . DB_HOST . ';dbname=' . DB_USERNAME, DB_USERNAME, DB_PASSWORD);
  
   $title = $_POST["title"];
   $authors = $_POST["authors"];
   $description = $_POST["description"];
   $price = $_POST["price"];
  
  $uploads_dir = "images/";
  
          $tmp_name = $_FILES["image"]["tmp_name"];
          $name = $_FILES["image"]["name"];
          $tmp_name2 = $_FILES["content"]["tmp_name"];
          $name2 = $_FILES["content"]["name"];
  
  
  
       move_uploaded_file($tmp_name, "$uploads_dir/$name");
       move_uploaded_file($tmp_name2, "$uploads_dir/$name2");
  
      $file_path=$uploads_dir. basename( $_FILES["image"]["name"]);
      $file_path2=$uploads_dir. basename( $_FILES["content"]["name"]);
  
  $stmt = $dbh-&gt;prepare("INSERT INTO books (title,authors,description,price,image, content)
   VALUES ('$title', '$authors', '$description', '$price',$file_path', '$file_path2')") ; 
   $stmt-&gt;execute();
  </code></pre>
  
  <p>I've looked at similar questions on here but the answers haven't concluded my problem. I have tried the $uploads_dir variable as images/ and as its complete path /project/folder/user/images/ both give the same error.  </p>
  
  <p>Note: this php script is in the parent folder of images/.   </p>