I'm trying to upload a picture from trigger.io to my web app. Everything is fine, but depending on the source the key to the file in the $_FILES array is different. When selecting from the gallery on Android it seems to be $_FILES[0], when taking a new picture on iOS it seems to be $_FILES[file_name_ext] (with a _ replacing a . for the file extension)...
Is there a way to set what the key will be or do I need to add logic to the server side that just looks for anything in the $_FILES array?
Thanks
PS - on PhoneGap you pass a parameter called "fileKey"... I'm looking for the equivalent in Trigger.io
You can set the "name" attribute on a file object and we will use that in the POST body, e.g.
forge.file.getImage({width: 200, source: "gallery"}, function (file) {
file.name = "my_file_name";
forge.request.ajax({
url: "http://httpbin.org/post",
files: [file],
success: function (resp) {
forge.logging.info(resp);
}
});
});
See http://docs.trigger.io/en/v1.4/modules/request.html#ajax.