Upload file attachment with rest or xml

I've a "attachment" model that has:

title: string
image: paperclip attribute
video: paperclip attribute

I want to let the users to upload an attachment by using xml or
something like that, all the actions supports xml

If they call the controller/action (http://example.net/attachments) with
a post, right now they could do something like

curl -H "Content-Type: application/xml" -X POST -d
"<attachment><title>Nice Picture</title></attachment>"

But I would like to get a way to test that if I upload the file by using
curl or anything else, they will be able to upload the file, if they
give it the param "image" it will be processed as an image, if they give
it the param "video" it will be processed as a video

But I don't have idea how they may call the action with the xml and
upload the file, or if I should use another way or what


Any help on this one?

BTW, the code I had for the rails code is pretty simple


I'm just looking the way to upload a file by using a third party
application (I'm trying to provide an api to customers)

Thank you

I'll see if I can help. Can you explain what you want to see happen
that's not? What do the logs tell us? If you're able to make this work
in some situations, compare the log output to a failed request and see
if the differences give us any clues.