[twitter-dev] Re: update_profile_image gives me head ache

2009-03-15 Thread Einar

Thanks for the input.
I found out I forgot to sent the Content-Length header field. Then
Twitter accepts the image. But the image that show up is just a white
square. I'd guess the API doesn't accept base64 encoded image
transfers. I will try to rewrite the routine to send the image as
binary information instead.



On Mar 15, 6:51 am, TjL luo...@gmail.com wrote:
 FWIW, I've had trouble uploading a profile picture using the web
 interface itself (it seems to accept it, but then doesn't show it). It
 hardly seems like the most robust feature. Normally I just keep trying
 and waiting a few minutes to see if it actually went through.


[twitter-dev] Re: update_profile_image gives me head ache

2009-03-14 Thread Zachary West
Hi Einar,
You seem to be submitting your POST request incorrectly. This is how I
(successfully) submit my update_profile_image:

Content-type: multipart/form-data; boundary=BOUNDARYHERE
--BOUNDARYHERE
Content-Disposition: form-data; name=image; filename=FILENAMEHERE.png
Content-Type: image/png

(image)
--BOUNDARYHERE--

Zachary West

On Sat, Mar 14, 2009 at 14:46, Einar m...@einarsundgren.se wrote:


 I'm currently working on a c++ wrapper for the twitter API. Everything
 works smooth except uploading images. Both profile images and
 background images. The image I use is a png which already has been
 used as an Twitter avatar. So the response about a big image does not
 seem very likely.

 I send a HTTP-request that looks like this.
 Any idea why it won't work?

 
 POST /account/update_profile_image.xml HTTP/1.1
 Host: twitter.com
 Accept: */*
 Accept-Language: en-gb
 User-Agent: Twittertester/01
 Authorization: Basic ZgGreEmKxxClMy  //No thats not my auth.
 No need to decode ;-)
 Connection: close

 Content-Type: multipart/mixed; boundary=limiter
 --limiter
 Content-Type: image/png
 Content-Description: Profile image
 Content-Transfer-Encoding: base64

 iVBOR (... and so forth... A base64 encoded png image...) CYII=
 --limiter--
 ***

 The response:
 *
 ?xml version=1.0 encoding=UTF-8?
 hash
  request/account/update_profile_image.xml/request
  errorThere was a problem with your picture. Probably too big./
 error
 /hash
 **



[twitter-dev] Re: update_profile_image gives me head ache

2009-03-14 Thread TjL

FWIW, I've had trouble uploading a profile picture using the web
interface itself (it seems to accept it, but then doesn't show it). It
hardly seems like the most robust feature. Normally I just keep trying
and waiting a few minutes to see if it actually went through.