English 中文(简体)
Trouble uploading to twitpic
原标题:

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--
最佳回答

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.

问题回答

暂无回答




相关问题
How to set response filename without forcing "save as" dialog

I am returning a stream in some response setting the appropriate content-type header. The behavior I m looking for is this: If the browser is able to render content of the given content type then it ...

Which Http redirects status code to use?

friendfeed.com uses 302. bit.ly uses 301. I had decided to use 303. Do they behave differently in terms of support by browsers ?

Does HttpWebRequest send 200 OK automatically?

Background: I am implementing Paypal IPN handler. This great article on Paypal states that I am required to send a 200 OK back to Paypal after I read the response. The processing of IPN request is ...

Java HTTPAUTH

我试图把桌面应用程序连接起来,我是同D.icio.us api @ Delicious Alan书写的,简单地向他们提供我的用户名和密码,并请他把书记上写给我......。

Finding out where curl was redirected

I m using curl to make php send an http request to some website somewhere and have set CURLOPT_FOLLOWLOCATION to 1 so that it follows redirects. How then, can I find out where it was eventually ...

热门标签