HELP! update_with_media, content length, HTTP 400, 403


#1

I’m trying to upload an image with PHP. I’m using no libraries. OAuth part is done and working but i have other problems, i guess building the POST content or header.

If i don’t include Content Length, i get a 403 forbidden, with 195: missing or invalid url parameter. If i include it, i get a 400 bad request. However i am pretty sure i have it calculated right.

These are my headers + data:
Content Length: 2564
Authorization: OAuth oauth_consumer_key=“kek”, oauth_nonce=“kek”, oauth_signature=“kek”, oauth_signature_method=“HMAC-SHA1”, oauth_timestamp=“1416531635”, oauth_token=“kek”, oauth_version="1.0"
Content-type: multipart/form-data;boundary=kekekekekekekekekekekekekekekekekekekekep0egpsokgpoesjg094kgpkgsaaaaaaaakg0skg

–kekekekekekekekekekekekekekekekekekekekep0egpsokgpoesjg094kgpkgsaaaaaaaakg0skg
Content-Disposition: form-data; name=“status” dend

–kekekekekekekekekekekekekekekekekekekekep0egpsokgpoesjg094kgpkgsaaaaaaaakg0skg

Content-Type: application/octet-stream
Content-Transfer-Encoding: base64; name=“media[]”; filename=“mandala.jpg” [base64 img data]
–kekekekekekekekekekekekekekekekekekekekep0egpsokgpoesjg094kgpkgsaaaaaaaakg0skg–


#2

I believe update_with_media has been deprecated.


#3

I must use the method for uploading several pictures?

If i look at the documentation for update_with_media, it seems more like its the documentation that is deprecated, not the method?

I will try using the other way. It’s more complicated though :confused:


#4

Hi @cat_abyss,

Please see Media/upload POST Base 64 where I was informed that the upload_with_media endpoint still works but has been deprecated.

Instead, we are to use the /1.1/media/upload.json end-point where we can upload files and receive ID’s per file.

https://dev.twitter.com/rest/public/uploading-media-multiple-photos