title: Upload File using a form in wordpress
body: <p>I want to upload files to a folder called uploads in my wordpress theme. But it is not uploading the files. Can anybody please help , below is my code</p>
  
  <p>HTML Code</p>
  
  <pre><code>&lt;form action="" method="post" enctype="multipart/form-data"&gt;
      &lt;input type="file" name="file"&gt;
      &lt;input type="submit"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>[upload]</p>
  
  <p>Below is php code of shortcode in functions.php file</p>
  
  <pre><code>functions upload ()
  {
  $file = $_FILES['file'];
  $name = $file['name'];
  $path = "/uploads/" . basename($name);
  if (move_uploaded_file($file['tmp_name'], $path)) {
      echo " Move succeed";
  } else {
   echo " Move failed. Possible duplicate?";
  }
  }
  
  add_shortcode('upload','upload');
  </code></pre>
  
  <p>Thanks</p>