title: move_uploaded_file() Unable to move file from tmp to dir
body: <p>I've been searching for the solution but I can't find the answer.</p>
  
  <p>I created a image upload form. It runs with ajaxform plugin. But still it doesn't upload to the directory.
  The error_log says </p>
  
  <blockquote>
    <p>move_uploaded_file() Unable to move file from [tmp] to [dir]. </p>
  </blockquote>
  
  <p>Then on the front end it says Upload Complete. But when the file is called, it doesn't exist.</p>
  
  <p>HTML CODE:</p>
  
  <pre><code>&lt;div class="imgupload hidden"&gt;  
      &lt;form id="profpicform" action="" method="post" enctype="multipart/form-data"&gt;
          &lt;input type="file" size="60" name="profpic"&gt;
          &lt;input type="submit" value="Submit File"&gt;
      &lt;/form&gt;
  
      &lt;div class="imguploadStatus"&gt;
          &lt;div class="imguploadProgress"&gt;
              &lt;div class="imguploadProgressBar"&gt;&lt;/div&gt;
              &lt;div class="imguploadProgressPercent"&gt;0%&lt;/div&gt;
          &lt;/div&gt;
          &lt;div class="imguploadMsg"&gt;&lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="imgpreview"&gt;&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>JS:</p>
  
  <pre><code>var options = { 
      beforeSend: function() 
      {
          $(".imguploadProgress").show();
          $(".imguploadProgressBar").width('0%');
          $(".imguploadMsg").html("");
          $(".imguploadProgressPercent").html("0%");
      },
      uploadProgress: function(event, position, total, percentComplete) 
      {
          $(".imguploadProgressBar").width(percentComplete+'%');
          $(".imguploadProgressPercent").html(percentComplete+'%');
  
      },
      success: function() 
      {
          $(".imguploadProgressBar").width('100%');
          $(".imguploadProgressPercent").html('100%');
  
      },
      complete: function(response) 
      {
          alert('Complecion');
      },
      error: function()
      {
          $(".imguploadMsg").html("&lt;font color='red'&gt; ERROR: unable to upload files&lt;/font&gt;");
      }
  
      }; 
  
       $("#profpicform").ajaxForm(options);
  </code></pre>
  
  <p>SEVER SIDE:</p>
  
  <pre><code>$output_dir = home_url()."/path/to/dir/";
  
  if(isset($_FILES["profpic"])){
      if ($_FILES["profpic"]["error"] &gt; 0){
        echo "Error: " . $_FILES["file"]["error"] . "&lt;br&gt;";
      }else{
          move_uploaded_file($_FILES["profpic"]["tmp_name"],$output_dir. $_FILES["profpic"]["name"]);
          if(get_user_meta($_SESSION['userid'], 'user_profile_picture')==""){
              add_user_meta($_SESSION['userid'], 'user_profile_picture', $_FILES['profpic']);
          }else{
              update_user_meta($_SESSION['userid'], 'user_profile_picture', $_FILES['profpic']);
          }
          echo "Uploaded File :".$_FILES["profpic"]["name"];
      }
  }
  </code></pre>
  
  <p>They are only found in one PHP file. Folder permission for the directory is 777.</p>