views:

253

answers:

1

I am posting (HTTP POST) various values to the posterous api. I am successfully able to upload the title, body, and ONE media file, but when I try to add in a second media file I get a server 500.

They do allow media and media[] as parameters.

How do I upload multiple files with the iPhone SDK?

A: 

The 500 your getting is probably based on one of two things:

  • An incorrect request
  • An error on the server

Now, if its an incorrect, the HTTP server would be more helpful responding back with like a 415 (unsupported media type) or something. A 500 insists that something went wrong on the server and that your request was valid.

You'll have to dig into the server API or code (if you wrote it), or read the docs and figure out what's wrong with your second request ... seems like maybe your not setting the appropriate media type?

EDIT: Ok, so I looked at the API. It appears your posting XML, so your request content-type should be

Content-Type: application/xml

The API doc didn't specifically say, but that would be the correct type.

EDIT: Actually on second glance, are you just POSTing w/URI params? Their API doc isn't clear (I'm also looking rather quickly)

Mr-sk
I didn't write the API. It is posterous. Thanks for the feedback. I will look at the media type again.
Cory Wiles
I changed some of my code around and now I am getting back a more intelligible response: "unsupported media type"
Cory Wiles
Ok - I expanded my OP.
Mr-sk