I have stumbled to following code example:
$image = 'file/path';
$code = $tmhOAuth->request('POST', 'https://upload.twitter.com/1/statuses/update_with_media.json',
array(
'media[]' => "@{$image}",
'status' => "Don't slip up" // Don't give up..
),
true, // use auth
true // multipart
);
The confusing bit is “@{$image}”, what that “at” sign does in front of the file path?
Thanks!
I don’t know what library you’re using, but I assume it uses the PHP cURL extension internally, because that’s how you specify to cURL the path to a file that you want to upload, i.e., by prepending the path with an
@. See this example from the PHP manual: