how to create multipart mime data?

I need to create a mime attachment for facebooks me/photos post. can’t work out how to do the encoding.

i’ve tried this but no luck
[lua]local mime = {
headers = {
[“content-type”] = ‘image/jpg; name=“screencapture.jpg”’,
[“content-disposition”] = ‘attachment; filename=“screencapture.jpg”’,
[“content-description”] = ‘a screenshot’,
[“content-transfer-encoding”] = “BASE64”
},
body = ltn12.source.chain(
ltn12.source.file(io.open(path, “rb”)),
ltn12.filter.chain(
mime.encode(“base64”),
mime.wrap()
)
)
}[/lua]

any ideas?

thanks
j [import]uid: 6645 topic_id: 8167 reply_id: 308167[/import]

@ansca: i think facebook.request creates all the mime headers though for us? is the source (or image?) property exposed? and if so what data would it take?

thanks
j [import]uid: 10744 topic_id: 8167 reply_id: 29105[/import]

Part of the problem is the format you have is not quite right.
Your headers should actually be Part headers not request headers.

i’ve been working ont his functionality for about 6 hours now without getting it to work. I can do everything except actually transfer the file data.

If I find a solution, I’ll certainly post it as I see a lot of folks needing it.

IMO - its amazing to me that it’s not already in Corona [import]uid: 22381 topic_id: 8167 reply_id: 62934[/import]

Solved!

Multipart form data. see:
http://developer.anscamobile.com/code/how-upload-image-server-multipartform-data [import]uid: 22381 topic_id: 8167 reply_id: 62945[/import]

corona, please include that !! [import]uid: 4795 topic_id: 8167 reply_id: 106690[/import]