Upload Object
The SDK method listed in this section will allow you to upload objects to the bucket
If you do not have Versioning enabled for your object, and if Stratus gets multiple write requests for the same object, the object will be continuously overwritten. The latest upload of the object will be the only object that is stored.
However, with Versioning enabled, each upload will be considered a version of the object, and all of them will be stored in the bucket, each with a unique versionId.
Upload an Object Using Path (Completion Callback)
This SDK can be used to upload an object to the bucket using its path.
Parameters Used
Parameter Name | Definition |
---|---|
filePath | A mandatory parameter. Will contain the complete path of the location from where the file needs to be uploaded from. |
fileName |
|
shouldCompress |
|
copybucketInstance.upload( filePath : "{file_path}", fileName : "{file_name}", shouldCompress : true ) { error in if let error = error { print("Error : \( error )") return } print("Uploaded Successfully") }
Upload an Object Using File Name and File Data (Completion Callback)
This SDK can be used to upload an object to the bucket using its name and in a data format.
Parameters Used
Parameter Name | Definition |
---|---|
fileName | A mandatory parameter. Will contain the complete name of the object that needs to be uploaded. |
data | A mandatory parameter. The object that needs to be uploaded in data format. |
shouldCompress |
|
copybucketInstance.upload( fileName : "{file_name}", data : "{file_data}", shouldCompress : false ) { error in if let error = error { print("Error : \( error )") return } print("Uploaded Successfully") }
Upload an Object Using Path (With Progress)
This SDK can be used to upload an object to the bucket using its path. This SDK method will also provide upload progress indicators.
Parameters Used
Parameter Name | Definition |
---|---|
fileRefId | A unique ID to refer to the file that is being uploaded. |
filePath | A mandatory parameter. Will contain the complete path of where the file should be uploaded. |
fileName |
|
shouldCompress |
|
fileUploadDelegate | This is a protocol that needs to be confirmed. the Upload delegate object is essential to track the status of the object upload. |
copybucketInstance.upload( fileRefId : "{file_ref_id}", filePath : "{file_path}", fileName : "{file_name}", shouldCompress : true, fileUploadDelegate : self )
Upload an Object Using File Name and File Data (With Progress)
This SDK can be used to upload an object to the bucket using its name and in a data format. This SDK method will also provide upload progress indicators.
Parameters Used
Parameter Name | Definition |
---|---|
fileRefId | A unique ID to refer to the file that is being uploaded. |
data | A mandatory parameter. The object that needs to be uploaded in data format. |
fileName |
|
shouldCompress |
|
fileUploadDelegate | This is a protocol that needs to be confirmed. the Upload delegate object is essential to track the status of the object upload. |
copybucketInstance.upload( fileRefId : "{file_ref_id}", fileName : "{file_name}", data : "{file_data}", shouldCompress : true, fileUploadDelegate : self)
Last Updated 2025-07-08 15:25:59 +0530 +0530
Yes
No
Send your feedback to us