title: Can't upload a file using wordpress upload functions
body: <p>I need to add logo upload functionality to a custom php plugin on wordpress.
  I found this code on wordpress codex:</p>
  
  <pre><code>if ( ! function_exists( 'wp_handle_upload' ) ) require_once( ABSPATH . 'wp-admin/includes/file.php' );
  $uploadedfile = $_FILES['editfile'];
  $upload_overrides = array( 'test_form' =&gt; false );
  $movefile = wp_handle_upload( $uploadedfile, $upload_overrides );
  if ( $movefile ) {
      echo "File is valid, and was successfully uploaded.\n";
      var_dump( $movefile);
  } else {
      echo "Possible file upload attack!\n";
  }
  </code></pre>
  
  <p>Here is the form:</p>
  
  <pre><code>&lt;form action="' . site_url('/edit-company/?cid=' . $_GET['cid']) . '" method="post"&gt;
                                                  &lt;label&gt;&lt;b&gt;Company Name:&lt;/b&gt;&lt;/label&gt; &lt;input type="text" name="editname" value="' . $company-&gt;company_name . '"&gt;
                                                  &lt;label&gt;&lt;b&gt;Address:&lt;/b&gt;&lt;/label&gt; &lt;input type="text" name="editaddress" value="' . $company-&gt;company_address . '"&gt;
                                                  &lt;label&gt;&lt;b&gt;Telephone:&lt;/b&gt;&lt;/label&gt; &lt;input type="text" name="edittelephone" value="' . $company-&gt;company_telephone . '"&gt;
                                                  &lt;label&gt;&lt;b&gt;Fax:&lt;/b&gt;&lt;/label&gt; &lt;input type="text" name="editfax" value="' . $company-&gt;company_fax . '"&gt;
                                                  &lt;label&gt;&lt;b&gt;Email:&lt;/b&gt;&lt;/label&gt; &lt;input type="text" name="editemail" value="' . $company-&gt;company_email . '"&gt;
                                                  &lt;label&gt;&lt;b&gt;Website:&lt;/b&gt;&lt;/label&gt; &lt;input type="text" name="editwebsite" value="' . $company-&gt;company_website . '"&gt;
                                                  &lt;label&gt;&lt;b&gt;Logo:&lt;/b&gt;&lt;/label&gt; &lt;input type="file" name="editfile" id="file"&gt;
                                                  &lt;input type="submit" value="Submit"&gt;
                                              &lt;/form&gt;
  </code></pre>
  
  <p>If I submit a file to this it gives me the following error:</p>
  
  <blockquote>
    <p>File is valid, and was successfully uploaded. array(1) { ["error"]=>
    string(212) "File is empty. Please upload something more substantial.
    This error could also be caused by uploads being disabled in your
    php.ini or by post_max_size being defined as smaller than
    upload_max_filesize in php.ini." }</p>
  </blockquote>
  
  <p>The file I am submitting is about 50kb in size. Uploading bigger or smaller files doesn't seem to make a difference.</p>
  
  <p>I have no problem uploading files of any size in Wordpress admin do I wouldn't think php.ini or post max size is causing this.</p>
  
  <p>If you have any tips or info on this please let me know. I have been stuck on this for quite some time now. Tried using simple upload script in vanilla PHP but that also doesn't seem to work so I am back at trying to get it done with wp functions.</p>
  
  <p>UPDATE:
  - tried setting the permissions of the upload folder to 777 - no help</p>