Problem uploading files to API (Cloudinary)

Cloudinary is a great service and I think every Corona user should have the ability to use it.

Whether I use network.request with a base64-encoded image or network.upload, the same error still persists:

{"error":{"message":"Missing required parameter - file"}} 

I think this question has been asked for years, and I think we should cover it. Can we upload files to a remote service with network.request? If not, can we customize network.upload with a custom param defining what param to store the upload data? I believe it defaults to “body”, and Cloudinary for example requires “file”

Here is the code, I’ve tried it a hundred different ways so it’s somewhat overdone. 

function cloud:uploadFile ( fileMetaTable, callback ) local networkListener = function (event) print("cloudinary pinged") if event == nil or json.decode(event.response) == nil or json.decode(event.response).error then print("wloudinary failed " .. tostring(event.response)) else print("wloudinary succeeded " .. event.response) if callback then callback(event);end end end local options = {} options.timestamp = os.time(), options.signature = "XXX", options.api\_key = cloud.api.key, options.file = "data:image/jpeg;base64," .. cloud:encodeFile( fileMetaTable ) options.fileKey = "file"; options.fileName = system.pathForFile(fileMetaTable.filename, system[fileMetaTable.baseDir]); options.mimeType = "image/jpeg"; options.chunkedMode = false; options.headers = { Connection = "close" }; network.request(cloud.api\_url .. cloud.name .. "/image/upload","POST",networkListener, options)