title: xampp php file upload error
body: <p>I can't figure out what's going wrong with my file upload on php.</p>
  
  <p>php code:</p>
  
  <pre><code>&lt;?php 
  session_start();
  if ($_SESSION['Loggedin']!="Yes") {
      header('location:index.php');
      exit();
  }
  require_once('Connect.php');
  
  //This is the directory where images will be saved
  $target = "../htdocs/sites/tryouts/newgames/images/main-news/";
  $target = $target . basename( $_FILES['photo']['name']);
  
  //This gets all the other information from the form
  $author=$_POST['author'];
  $title=$_POST['title'];
  $pic=($_FILES['photo']['name']);
  $bericht=$_POST['bericht'];
  
  
  
  //Writes the information to the database
  mysqli_query($Connection, "INSERT INTO nieuws (Nieuws_Author,Nieuws_Title,Nieuws_Image,Nieuws_Bericht)
  VALUES ('$author', '$title', '$pic', '$bericht')") ;
  
  //Writes the photo to the server
  if(move_uploaded_file($_FILES['photo']['tmp_name'], $target))
  {
  
  //Tells you if its all ok
  echo "The file ". basename( $_FILES['photo']['name']). " has been uploaded, and your information has been added to the directory";
  }
  else {
  
  //Gives and error if its not
  echo "Sorry, there was a problem uploading your file.";
  }
    ?&gt;
  </code></pre>
  
  <p>I get 2 errors:</p>
  
  <blockquote>
    <p>Warning:
    move_uploaded_file(../htdocs/sites/tryouts/newgames/images/main-news/bandicam
    2014-05-2919-48-59-499.jpg): failed to open stream: No such file or
    directory in
    C:\Users\xammp\htdocs\sites\tryouts\newgames\addnewsscripts.php on
    line 26</p>
  </blockquote>
  
  <p>and</p>
  
  <blockquote>
    <p>Warning: move_uploaded_file(): Unable to move
    'C:\Users\xammp\tmp\php24D.tmp' to
    '../htdocs/sites/tryouts/newgames/images/main-news/bandicam 2014-05-29
    19-48-59-499.jpg' in
    C:\Users\xammp\htdocs\sites\tryouts\newgames\addnewsscripts.php on
    line 26 Sorry, there was a problem uploading your file.</p>
  </blockquote>
  
  <p>I already have checked that php file upload is set on and the dir is:</p>
  
  <blockquote>
    <p>upload_tmp_dir = "C:\Users\xammp\tmp"</p>
  </blockquote>
  
  <p>can you figure out what i am doing wrong?
  probaly it is the directory where i want to place my images in but which target directory do i need to use?</p>