views:

140

answers:

1

Hi,

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--
A: 

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