title: Php file won't upload error 6 (Missing a temporary folder)
body: <p>I have a PHP website and I am trying to create a page where people can upload an image to the server. </p>
  
  <p>However it is not working and I am getting an error code 6 from the files variable. </p>
  
  <p>I have researched this and apparently it means that it is missing a temporary directory, however I have correctly set the temporary folder in the php.ini and it still won't work. </p>
  
  <p>Here is the contents of the $_FILES array:</p>
  
  <pre><code>Array ( [fileToUpload] =&gt; Array ( [name] =&gt; maxresdefault.jpg [type] =&gt; [tmp_name] =&gt; [error] =&gt; 6 [size] =&gt; 0 ) ) 
  </code></pre>
  
  <p>Edit: I am running IIS on windows 10 as my server</p>
  
  <p>Edit: Here is my code:</p>
  
  <pre><code>&lt;?php
  ini_set('display_errors', 'On');
  error_reporting(E_ALL);
  
  $sys_vars["uploads"]++;
  
  $target_dir = "../";
  $target_file = $target_dir . $sys_vars["uploads"];
  $uploadOk = 1;
  $imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
  $path_parts = pathinfo($_FILES["fileToUpload"]["name"]);
  echo $_FILES["fileToUpload"]["error"];
  if(isset($_POST["submit"])) {
      $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
      if($check !== false) {
          echo "File is an image - " . $check["mime"] . ".";
          $uploadOk = 1;
      } else {
          $uploadOk = 0;
          //header("Location: upload.php?error=File is not an image.");
          echo "File is not an image.";
          die();
      }
  }
  
  if (file_exists($target_file)) {
      echo "Sorry, file already exists.";
      $uploadOk = 0;
  }
  
  if ($_FILES["fileToUpload"]["size"] &gt; 500000) {
      echo "Sorry, your file is too large.";
      $uploadOk = 0;
      //header("Location: upload.php?error=Sorry, your file is too large.");
      die();
  }
  
  if($imageFileType != "jpg" &amp;&amp; $imageFileType != "png" &amp;&amp; $imageFileType != "jpeg") {
      echo "Sorry, only JPG, JPEG &amp; PNG files are allowed.";
      echo $imageFileType;
      echo $_FILES["fileToUpload"]["tmp_name"];
      $uploadOk = 0;
      //header("Location: upload.php?error=Sorry, only JPG, JPEG &amp; PNG files are allowed.");
      die();
  }
  
  if ($uploadOk == 0) {
      echo "Your file was not uploaded.";
      //header("Location: upload.php");
      die();
  
  } else {
      if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], "/")) {
          echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded.";
      } else {
          echo "Sorry, there was an error uploading your file.";
          print_r ($_FILES);
          //header("Location: upload.php?error=Sorry, there was an error uploading your file.");
          die();
      }
  }
  ?&gt;
  </code></pre>