problem with upload image

@coedin coedin
  1. $twitteroauth = $in2social->TwitterOAuth($token['oauth_token'],$token['oauth_secret']);            
  2.            /*  $twitter = $twitteroauth->post('statuses/update', array(
  3.                                                   'status' => $message
  4.                                                   ));  
  5.                         */
  7.            $twitter = $twitteroauth->post('statuses/update_with_media.json', array(
  8.                                                   'status' => $message ,
  9.                                                                                                          '@media[]' => "@{$image}"
  10.                                                   ));   

i 'am post with this funnction but the image/status not post . in script commad i am use this script this message post in twitter
why update_with_media.json not function ??

1 year 48 weeks ago


@episod Taylor Singletary

Do you know if the library you're using is "magically" aware that statuses/update_with_media.json is on and not

1 year 48 weeks ago
@coedin coedin

i' am use TwitterOAuth by Abraham Williams – a Twitter API library
in file twitteroauth.php i'am set
/* Set up the API root URL */
public $host = "";
public $host = "";

but it not use ??

1 year 48 weeks ago
@episod Taylor Singletary

That would likely change what's considered the primary API host throughout the library -- you just want it scoped for this method. I believe that twitteroauth allows you to specify a fully qualified URL on a per-method basis:

$twitteroauth->post('', ...) may get you where you need to go. That said, I'm not sure how well the library is prepared to handle multipart OAuth like this.

1 year 48 weeks ago
@Samer_Melhem Samer Melhem

if you want to tweet images using twitter api you can check our blog to see all the steps and download the example:

42 weeks 3 days ago
@RThaveesha Ravindu thaveesha

hi i did it using i did it using TwitterOAuth by Abraham Williams modified library


<form action="" method="POST" enctype="multipart/form-data">
<label for="status">Tweet Text</label>
<textarea type="text" name="status" rows="5" cols="60"></textarea>
<br />

<label for="image">Photo</label>
<input type="file" name="image" />
<br />
<input type="submit" value="Submit" />


if (!empty($_FILES)) {
// we set the type and filename are set here as well
$params = array(
'media[]' => "@{$_FILES['image']['tmp_name']};type={$_FILES['image']['type']};filename={$_FILES['image']['name']}",
'status' => $_POST['status']

$dd = $twitteroauth->post('statuses/update_with_media',$params,true);


download modified library here

15 weeks 4 days ago
@fiza51852756 fiza

@RThaveesha in require which library i should use?

12 weeks 6 days ago