简体   繁体   中英

How to POST an image to Twitter by statuses/update_with_media in Lua

I have problems building the header and/or body of the http-POST for a Twitter oAuth update_with_media call in Lua.

  • I'm using multipart/form-data as Content-Type
  • All oauth_* parameters are included in the body, including an oauth_signature .
  • POSTing to url https://upload.twitter.com/1/statuses/update_with_media.json

The problem is I have no idea how to successfully add the image data (media[]) to the body, in addition to 'status' and the other oauth parameters.

Also, how do I calculate the Content-Length ?

As of yet, I'm constantly getting a 500 Internal Server Error back form Twitter.

Can anyone provide me with a code snippet to add image data (jpg) to a POST? I'm using the Corona SDK btw, if that makes any difference.

If any help, please refer to this issue: Twitter API `status/update_with_media` return `404 Not Found`

If your still get the 500 error, please refer to this one: https://dev.twitter.com/discussions/1525

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM