title: Twitter API upload with PHP OAuth
body: <p>I've been trying to find the best OAuth PHP lib for Twitter for hours. the TmhOAuth by Matt Harris seems kinda bloated (no offence) and started shooting PHP Warnings and Strict Standards notices right after I "installed" it.</p>
  
  <p>All I want is to update my bg photo through the API. Just mine, so there is no need for any login and callbacks of any kind, all the keys are hard-coded.</p>
  
  <p>In the end I found out about PHP's own thing: <a href="http://php.net/manual/en/book.oauth.php" rel="nofollow">http://php.net/manual/en/book.oauth.php</a></p>
  
  <p>Seemed cool because everything has 4 lines of code. The auth works and I can push stuff through the API, I just can't seem to send the image parameter though. This is the method: <a href="https://dev.twitter.com/docs/api/1/post/account/update_profile_background_image" rel="nofollow">https://dev.twitter.com/docs/api/1/post/account/update_profile_background_image</a></p>
  
  <p>I've found some examples that were using upload forms, but I have the photo already saved in a file, so how do I provide the, quote, <strong>base64-encoded image as raw multipart data</strong>?</p>
  
  <pre><code>$oauth-&gt;fetch
  (
      'https://api.twitter.com/1/account/update_profile_background_image.json',
      array
      (
          'image' =&gt; '@' . $img_path . ';type=image/jpeg'
      ),
      'POST'
  );
  </code></pre>
  
  <p>Doesn't work, instead I get</p>
  
  <blockquote>
    <p>Fatal error: Uncaught exception 'OAuthException' with message 'Invalid auth/bad request (got a 500, expected HTTP/1.1 20X or a redirect)'</p>
  </blockquote>