title: WordPress: trying to upload image, the media_handle_upload() won't work
body: <p>Trying to make a form to upload an image to Wordpress, then set that image as a post's thumbnail. But I can't seem to get the media_handle_upload() function to work properly.</p>
  
  <p>the form's input for the file</p>
  
  <pre><code> &lt;input type="file" name="image" /&gt;
  </code></pre>
  
  <p>then this is the server side code</p>
  
  <pre><code>media_handle_upload( $_FILES['image'], 22 );
  </code></pre>
  
  <p>and this is what I get returned</p>
  
  <pre><code>object(WP_Error)#212 (2) { ["errors"]=&gt; array(1) { ["upload_error"]=&gt; array(1) { [0]=&gt; string(212) "File is empty...." } } ["error_data"]=&gt; array(0) { } }
  </code></pre>
  
  <p>I have played around with a couple different ways to enter the file variable,but none seems to work, am I doing that from, what exactly is the $file_id;</p>