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 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 |
|
shouldCompress | Boolean |
|
progress | Function |
|
copybucketIntance.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 |
|
progress | Function |
|
copybucketIntance.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 |
|
shouldCompress | Boolean |
|
progress | Function |
|
copyval 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
Yes
No
Send your feedback to us