# Files
In order to initiate a file upload to a storage in the cloud, a
module first needs to create a file in the /files
folder, and then publish a
message to {topics_files_out}
with the name of the file that needs to be
uploaded, and the target location in the storage (note that the location is
relative to the objectId that is requesting this upload). Sample payload
(objectId
, fromFile
and toFile
are required)
{
"objectId": "55555cb3-435d-4ef6-8779-9dd34f01a2b6",
"model": "abb.ability.device",
"fromFile": "backup_2017_08_08.zip",
"toFile": "backups/2017/08/08/backup.zip",
"removeOnComplete": true,
"correlationId": "a0656c75-3dea-4e30-8475-20f499fe0460"
}
If removeOnComplete
is true
, the local file will be deleted upon the successful
upload to the storage. Otherwise it is module's responsibility to remove the
file when it is no longer needed. If correlationId
is set, the module will
receive a notification once the upload has completed (whether successful or
not). Notification will be delivered on {topics_files_in}
with the following
payload:
{
"correlationId": "{correlation id from the initial request}",
"isSuccess": true/false,
"message": "{optional message}"
}
The files are uploaded to the object storage of the object that the file belongs
to, under the {objectId}
directory, where objectId
is provided in the upload
request.