title: File wont get saved in server, what to do?
body: <p>I've created a website where you upload pictures/files to a server and the database saves the place where the file is placed. Everything gets saved in the database but the file won't get saved in my server, what to do?</p>
  
  <pre><code>&lt;?php 
  
  
  $target = "bilder/"; 
  $target = $target . basename( $_FILES['photo']['name']); 
  
  $name=$_POST['name'];  
  $desc=$_POST['desc']; 
  $pic=($_FILES['photo']['name']); 
  
  mysql_connect("localhost", "root", "") or die(mysql_error()) ; 
  mysql_select_db("david") or die(mysql_error()) ; 
  
  mysql_query("INSERT INTO `bild` VALUES ('$name', '$desc', '$pic', NOW())") ; 
  
  if(move_uploaded_file($_FILES['photo']['tmp_name'], $target)) 
  { 
  
  echo "The file ". basename( $_FILES['photo']['name']). " was uploaded! &lt;br&gt;"; 
  echo "Click " . '&lt;a href="bilder.php"&gt;here&lt;/a&gt;' . " to see all uploaded files&lt;br&gt;";
  echo "Click " . '&lt;a href="test.html"&gt;here&lt;/a&gt;' . " to upload more files!";
  } 
  
  else { 
  echo "Error."; 
  } 
  ?&gt; 
  </code></pre>