I was wondering whether it\'s possible to upload a file from Mathematica to ifile.it. I have seen the API of ifile.it, however, I still don\'t know how it works. Furthermore
ragfield's answer gets points for not being a hack, but you can also do this without JLink:
UploadFile[url_, filePath_, urlParams___] := With[
{
bytes = Import[filePath, "Byte"],
filename = StringJoin[FileBaseName[filePath], ".", FileExtension[filePath]]
},
URLExecute[
url,
urlParams,
"Method" -> "POST",
"MultipartElements" -> {
{"file\"; filename=\"" <> filename, "application/octet-stream", bytes}
},
"Headers" -> {
"Accept" -> "application/json; charset=UTF-8",
"Content-Type" -> "multipart/form-data"
}
]
]
(Cross-answered from https://mathematica.stackexchange.com/questions/52338/more-complete-mutipartdata-posts-using-urlfetch/97658#97658)