title: PHP File Upload Script is not writing to temp directory
body: <p>Alright, so I am having an issue with my image uploading script/application. I have tried debugging time after time again and still cannot find out what the issue is. The code seems to be fine, but for some reason or another the file looks like it's not get saved in the temp directory so that it can then moved over to my uploads directory on my server. I have made certain that the directory(uploads) that i'm trying to upload it to, including the temp directory, have read/write/execute permissions set and that uploads is set to on in the php.ini folder. I have a feeling that the files are never getting saved to the temp folder, but i'm not sure how to check if that is the case, since i understand the file is deleted after the script finishes executing. I hope you guys can help me out, because I have no clue what to do. There's the code for my script.</p>
  
  <p>Also, this is where my issue is located at. </p>
  
  <pre><code>if (is_uploaded_file($filetempname)) {
            $final = "../public_html/uploads/" . $filename;              
            $result = move_uploaded_file($filetempname, $final);
            if($result)
            {
              echo 'success';
              echo "&lt;br&gt;Stored in: " . "public_html/uploads/" . $filename;
            }
            else
            {
              echo 'Image was not uploaded.';
            }
  </code></pre>
  
  <p>$result= move_uploaded_file($filetempname, $final) keeps returning false with no sign of an error occuring. I know that if the file type is not correct it'll return false and won't do copy anything and also it'll return false if the file cannot be moved for some reason and it will raise an alert message saying that. However, I'm not having a message raised at all. All I know is that it returns false and it doesn't do what it should do.</p>
  
  <pre><code>&lt;?php
  error_reporting(E_ALL);
  print_r($_FILES);
  $filetype = $_FILES["file"]["type"];
  $filename = $_FILES["file"]["name"];
  $filetempname = $_FILES["file"]["tmp_name"];
  $filesize = $_FILES["file"]["size"];
  $error = $_FILES["file"]["error"];
  
  $allowedExts = array("gif", "jpeg", "jpg", "png");
  $extension = end(explode(".", $filename));
  if ((($filetype == "image/gif")
  || ($filetype == "image/jpeg")
  || ($filetype == "image/jpg")
  || ($filetype == "image/pjepg")
  || ($filetype == "image/x-png")
  || ($filetype == "image/png"))
  &amp;&amp; ($filesize &lt; 1000000)
  &amp;&amp; in_array($extension, $allowedExts)) {
      if ( $error &gt; 0) {
          echo "Error: " . $error . "&lt;br&gt;";
      }
      else {
          echo "Upload: " . $filename . "&lt;br&gt;";
          echo "Type: " . $filetype . "&lt;br&gt;";
          echo "Size: " . ($filesize / 1024) . " KB&lt;br&gt;";
          echo "Stored in: " . $filetempname . "&lt;br&gt;";
  
          if (file_exists("../public_html/uploads/" . $filename)) {
              echo $filename . " already exists. ";
          }        
          else {
              if (is_uploaded_file($filetempname)) {
                $final = "../public_html/uploads/" . $filename;              
                $result = move_uploaded_file($filetempname, $final);
                if($result)
                {
                  echo 'success';
                  echo "&lt;br&gt;Stored in: " . "public_html/uploads/" . $filename;
                }
                else
                {
                  echo 'Image was not uploaded.';
                }
              }
          }
      }
  }
  else {
      echo "Invalid file";
  }
  ?&gt;
  </code></pre>
  
  <p>Here's the code for the form.</p>
  
  <pre><code>&lt;form enctype="multipart/form-data" method="post" action="scripts/snap.php"&gt;
          &lt;!--&lt;p&gt;
              &lt;input id="plat" class="plat" name="plat" type="hidden" value="" /&gt;
              &lt;input id="plon" class="plon" name="plon" type="hidden" value=""  /&gt;
          &lt;/p&gt;--&gt;
          &lt;div class="row"&gt;
              &lt;label for="file"&gt;Select an image to Upload&lt;/label&gt;&lt;br /&gt;
              &lt;input type="file" name="file" id="file" /&gt;&lt;!--onchange="fileSelected();"--&gt; 
          &lt;/div&gt;
          &lt;div id="filename"&gt;&lt;/div&gt;
          &lt;div id="fileSize"&gt;&lt;/div&gt;    
          &lt;div id="fileType"&gt;&lt;/div&gt;
          &lt;div class="row"&gt;
              &lt;input type="submit" name="submit" value="Submit" /&gt;
              &lt;!--&lt;input type="button" onclick="uploadFile()" value="Upload" /&gt;--&gt;
          &lt;/div&gt;
          &lt;div id="progressNumber"&gt;&lt;/div&gt;
      &lt;/form&gt;
  </code></pre>