The following sample code shows how to upload an object body with the transfer-at-once method.
Here is what is happening in the sample code:
- Set key-value pairs (e.g., file name, file size, and the availability of an object body) in a KiiObject as needed.
- Call the
save(_:) method to create a new KiiObject.
- Create a reference to the target file (myImage.jpg).
- Start uploading by calling the
You need to create a KiiObject with the
save(_:) method prior to uploading its object body with the
Set the content type in a form of "type/subtype". The content type sent to Kii Cloud will be used when the object body is downloaded and when the object body is published and viewed on the browser.