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.

Note: The following characters including space are not supported when you create a path or an object: double quote, both angular brackets, hashtag, backward slash and pipe symbol.

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
  • An optional parameter. Will hold the complete name of the object.
  • Default Value: Will hold the value of the last path value that was used.
shouldCompress
  • An optional parameter. To allow you to choose if the object needs to be compressed or not.
  • Default Value: false.
    
copy
bucketInstance.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
  • An optional parameter. To allow you to choose if the object needs to be compressed or not.
  • Default Value: false.
    
copy
bucketInstance.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
  • An optional parameter. Will hold the complete name of the object.
  • Default Value: Will hold the value of the last path value that was used.
shouldCompress
  • An optional parameter. To allow you to choose if the object needs to be compressed or not.
  • Default Value: false.
fileUploadDelegate This is a protocol that needs to be confirmed. the Upload delegate object is essential to track the status of the object upload.
    
copy
bucketInstance.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
  • An optional parameter. Will hold the complete name of the object.
  • Default Value: Will hold the value of the last path value that was used.
shouldCompress
  • An optional parameter. To allow you to choose if the object needs to be compressed or not.
  • Default Value: false.
fileUploadDelegate This is a protocol that needs to be confirmed. the Upload delegate object is essential to track the status of the object upload.
    
copy
bucketInstance.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