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 File Path and Name

This SDK can be used to upload an object to the bucket using its complete name and path.

Parameters Used

Parameter Name Data type Definition
filePath String A mandatory parameter. Will contain the complete path of the location from where the file needs to be uploaded from.
fileName String
  • An mandatory parameter. Will hold the complete name of the object.
  • Default Value: Will hold the value of the last path value that was used.
shouldCompress Boolean
  • An optional parameter. To allow you to choose if the object needs to be compressed or not.
  • Default Value: false.
progress Function
  • An optional parameter. This is a callback function while uploading a file.
    
copy
bucketIntance.uploadObject("/Desktop", "Helplinecard.jpeg", true, { println(" >> Object Upload Success -$it") }, { println(" >> Object Upload Failed -$it") }, progress = { bytesWritten, contentLength, percentage -> println("Percentage: $percentage") } )

Upload an Object Using File Path

This SDK can be used to upload an object to the bucket using its complete path.

Parameters Used

Parameter Name Data type Definition
filePath String A mandatory parameter. Will contain the complete path of the location from where the file needs to be uploaded from.
shouldCompress Boolean
  • An optional parameter. To allow you to choose if the object needs to be compressed or not.
  • Default Value: false.
progress Function
  • An optional parameter. This is a callback function while uploading a file.
    
copy
bucketIntance.uploadObject("/Desktop", "Helplinecard.jpeg", true, { println(" >> Object Upload Success -$it") }, { println(" >> Object Upload Failed -$it") }, progress = { bytesWritten, contentLength, percentage -> println("Percentage: $percentage") } )

Upload an Object Using InputStream and File Name

This SDK can be used to upload an object to the bucket using its file name and an input stream of the object to be uploaded.

Parameters Used

Parameter Name Data type Definition
stream InputStream A mandatory parameter. Will contain the input stream of the object that needs to be uploaded.
fileName String
  • An mandatory parameter. Will hold the complete name of the object.
  • Default Value: Will hold the value of the last path value that was used.
shouldCompress Boolean
  • An optional parameter. To allow you to choose if the object needs to be compressed or not.
  • Default Value: false.
progress Function
  • An optional parameter. This is a callback function while uploading a file.
    
copy
val file = File("/Desktop/HelplineCard.jpg") val inputStream: InputStream = FileInputStream(file) bucketIntance.uploadObject(inputSrream, "Helplinecard.jpeg", true, { println(" >> Object Upload Success -$it") }, { println(" >> Object Upload Failed -$it") }, progress = { bytesWritten, contentLength, percentage -> println("Percentage: $percentage") } )

Last Updated 2025-07-08 19:37:39 +0530 +0530