I'm trying to implement an upload_with_media request from ajax using Abraham's twitteroauth library (TwitterOAuth v0.2.0-beta2). I've had no problems with basic posts but when I try to include media I get this as a response:
"{"request":"\/1\/statuses\/update_with_media.json","error":"Error creating status."}"
My code for posting media looks like this:
$image = $_FILES["media"]["tmp_name"];
$parameters = array(
'media[]' => "@{$image};type=image/jpeg;filename={$image}",
'status' => $status
);
if(isset($reply_id)) {
$parameters['in_reply_to_status_id'] = $reply_id;
}
$post = $twitteroauth->post('https://upload.twitter.com/1/statuses/update_with_media.json', $parameters);
echo json_encode($post);
I have verified that all data is being sent to this script correctly and even managed to get an update_with_media post working using the same data above and the tmhOAuth library but as the rest of my widget uses twitteroauth, I'd prefer to keep things uniform. I've also tried it with and without the .json affixed to the ending and saw no difference. Can anyone show me an example of a successful implementation of update_with_media using twitteroauth? I can't seem to figure out what I'm doing wrong.