Thanks a lot Matt. It worked. The two things I missed while trying to upload the background image using your excellent library.
1) include filename={thefilename.jpg} element in the parameter array 2) add the 'use' => 'true' element in the parameter array. Here is my final code $params = array( 'image' => "@{$img_path};type=image/jpeg;filename={$image}", ); $params['use'] = 'true'; $tmhOAuth->request('POST', $tmhOAuth->url("account/ update_profile_background_image"), $params, true, // use auth true // multipart ); On Oct 18, 6:54 pm, Matt Harris <thematthar...@twitter.com> wrote: > There's an example in the tmhOAuth github project that has code for this: > http://github.com/themattharris/tmhOAuth/blob/master/examples/images.php > > The big difference for background images is remembering to send the filename > as well. > There have also been some users who have found that their version of curl > required changing 'image' => to '@image' > > If neither of those work can you share the image that isn't working and > we'll see what could be the problem. > > Best > --- > @themattharris > Developer Advocate, Twitterhttp://twitter.com/themattharris > > > > On Mon, Oct 18, 2010 at 4:04 PM, x.charles.z <x.charle...@gmail.com> wrote: > > I used the exact same code for the profile pic update except changing > > the api function. The profile picture update works, but unfortunately > > the background image update fails. > > > $img_path = $_SERVER["DOCUMENT_ROOT"].'/images/twitter_bg/'.$image; > > > require_once('./application/libraries/tmhOAuth.php'); > > > $oauth_tokens = $this->session->userdata('twitter_oauth_tokens'); > > $tmhOAuth = new tmhOAuth(array( > > 'consumer_key' => T_CONSUMER_KEY, > > 'consumer_secret' => T_CONSUMER_SECRET, > > 'user_token' => $oauth_tokens['access_token'], > > 'user_secret' => $oauth_tokens['access_token_secret'] > > )); > > > $img_post = array('image' => "@{$img_path};type=image/jpeg;"); > > > $tmhOAuth->request('POST', $tmhOAuth->url("account/ > > update_profile_background_image"), $img_post, > > true, // use auth > > true // multipart > > ); > > > The picture is jpg and only 40kb > > > The response I had: > > > ( > > [date] => Mon, 18 Oct 2010 23:00:56 GMT > > [server] => hi > > [status] => 403 Forbidden > > [x_transaction] => 1287442856-44067-31467 > > > [code] => 403 > > [response] => {"error":"There was a problem with your background > > image. Probably too big.","request":"/1/account/ > > update_profile_background_image.json"} > > > Thanks for taking a look. > > > -- > > Twitter developer documentation and resources:http://dev.twitter.com/doc > > API updates via Twitter:http://twitter.com/twitterapi > > Issues/Enhancements Tracker: > >http://code.google.com/p/twitter-api/issues/list > > Change your membership to this group: > >http://groups.google.com/group/twitter-development-talk -- Twitter developer documentation and resources: http://dev.twitter.com/doc API updates via Twitter: http://twitter.com/twitterapi Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list Change your membership to this group: http://groups.google.com/group/twitter-development-talk