title: How to use function move_uploaded_file in php
body: <p>This code in "upload.php"</p>
  
  <pre><code>&lt;?php
      session_start();
          $id = $_SESSION['user_id'];
          $pic = $_FILES['pic']["name"];
          $folder = "../images/users/";
          move_uploaded_file($_FILES['pic']["tmp_name"], "$folder".$pic); 
  
          $mysqli = connectDB();
          upload($id,$pic,$mysqli);
      ?&gt;
  </code></pre>
  
  <p>Function upload</p>
  
  <pre><code>function upload($id,$pic,$mysqli)
      {
          $pic = $mysqli-&gt;real_escape_string($pic);
  
          $sql = "UPDATE users SET pic = '$pic' WHERE id = '$id'";
          $result = $mysqli-&gt;query($sql);
      }
  </code></pre>
  
  <p>and this code in html</p>
  
  <pre><code>&lt;form name="submit" action="include/upload.php" method="post"&gt;
      &lt;input type="file" value="Choose file" accept="image/*" id="pic" name="pic"&gt;
      &lt;input type="submit" value="Upload" name="submit"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>It's not working. Image not move folder and image path not insert in database.</p>