1

I am trying to upload a photo using the API and am having an issue that I hope you can help me with. Below, I have pasted the http request to the API (minus the twitter username/password). I am getting an error message back saying image not found, even though the image is there with the proper name "media". I have created a simple web project on my end to test to make sure the image is being encoded correctly, and it is. Is there anything in this request that you can see that would cause the api to reject this?

Thanks

POST /api/upload HTTP/1.1
Accept: */*
Referer: http://localhost:31898/ClientBin/DragDropTwitPic.xap
Content-Length: 2779
Content-Type: multipart/form-data; boundary=1eb2cc59-c390-4022-a47f-bb5c5a514e27
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; Zune 4.0; MS-RTC LM 8; .NET4.0C; .NET4.0E)
Host: twitpic.com
Connection: Keep-Alive
Pragma: no-cache
--1eb2cc59-c390-4022-a47f-bb5c5a514e27
Content-Disposition: form-data, name="media"; filename="test.jpg"
Content-Type: image/pjpeg
{encoded image removed}

--1eb2cc59-c390-4022-a47f-bb5c5a514e27
Content-Disposition: form-data; name="username"
{removed from this post}
--1eb2cc59-c390-4022-a47f-bb5c5a514e27
Content-Disposition: form-data; name="password"
{removed from this post}
--1eb2cc59-c390-4022-a47f-bb5c5a514e27--
Ely
  • 3,200
  • 1
  • 21
  • 18
  • SO killed the formating of the post, trying to see if I can fix it – Ely Dec 11 '09 at 17:22
  • Is there an extra line after Content-Type? – Daniel A. White Dec 11 '09 at 17:27
  • had to remove the encoded image bytes in order to get it to diplay properly. I have verified that the image is encoded properly by redirecting the url to a web site I created and parsing the image myself. – Ely Dec 11 '09 at 17:28
  • I keep getting 401 errors with my Java TwitPic integration. http://stackoverflow.com/questions/7247956/twitpic-oauth-echo-java-j2ee – StarlineVentures Sep 01 '11 at 03:46

1 Answers1

0

Figured it out. In the Content-Type Disposition for the file upload I had this:

Content-Disposition: form-data, name="media"; filename="test.jpg"

Instead of the required this: Content-Disposition: form-data; name="media"; filename="test.jpg"

Stupid commas.

Ely
  • 3,200
  • 1
  • 21
  • 18