title: WordPress plugin development : How to upload a file to the default "uploads" directory?
body: <p>I'm trying to upload files to the default &quot;wp-content/uploads&quot; directory. Have tried almost all the available tags, still not working.</p>
  <p>Few of the codes I tried:</p>
  <ol>
  <li><p><code>$filename = $_FILES[&quot;uploadfile&quot;][&quot;name&quot;];</code>
  $tempname = $_FILES[&quot;uploadfile&quot;][&quot;tmp_name&quot;];</p>
  <p>$folder= 'wp_upload_dir()'. $filename; <em>//This code is uploading the file to the &quot;wp-admin&quot; directory</em></p>
  <p>if(move_uploaded_file($tempname, $folder)){$response}</p>
  </li>
  <li><p><code>$uploaddir = 'uploads/'; </code>$uploadfile = $uploaddir . $filename;`</p>
  <p><code>if(move_uploaded_file($tempname, $uploadfile))</code></p>
  </li>
  </ol>
  <p>`</p>