Upload an Object to a Bucket
An object can be data in any format. You can upload it directly from your local system using a directory structure customizable per your requirement.
To upload an object or a group of objects:
-
Click the Upload button and choose Upload Folder if you wish to upload an entire folder with all of its objects, or Upload File if you wish to upload a select group of objects or just one object.
-
If you choose to upload:
Upload Object Using Path
You can also upload objects to the bucket using the Create Path option.
-
Provide your required path using the your required path using the forward slash ‘/’ special character as the directory separator.
-
Click the upload-icon and select the required object in your local system and click Open to upload.
The entered path will be created and can be navigated in a manner you would a conventional directory.
The following SDK method enables you to upload an object to the bucket:
Ensure the following packages are imported:
import com.zc.component.stratus.beans.ZCPutObjectOptions;
import java.nio.file.Path;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.io.*;
InputStream file =new FileInputStream(“filePath”);
Boolean res = bucket.putObject(“objectName”, file);
System.out.println(res);
// create a read stream for upload the object
const file = fs.createReadStream(“file_path”);
// call the upload method
const res = await bucket.putObject(“object_name”, file);
console.log(res);
file = open(‘file_path’,‘rb’)
res = bucket.put_object(‘object_name’,file)
print(res)
const putObject = stratus.putObject("{object_name}","{File}", “{options}”, “{processCallback}”);
const putObjectStart = putObject.start(); // to start the request
const putObjectAbort = putObject.abort(); // to abort the request
bucketInstance.upload( filePath : “{file_path}”, fileName : “{file_name}”, shouldCompress : true ) { error in
if let error = error {
print(“Error : ( error )”)
return
}
print(“Uploaded Successfully”)
}
bucketIntance.uploadObject("/Desktop", “Helplinecard.jpeg”, true,
{
println(" » Object Upload Success -$it")
},
{
println(" » Object Upload Failed -$it")
},
progress = { bytesWritten, contentLength, percentage ->
println(“Percentage: $percentage”)
}
)
try{
XFile? imageFile = await pickImage(ImageSource.gallery);
var bucket = stratus.bucket(“testing”);
var response = await bucket.uploadObject(imageFile!.path);
print(“Upload Status: ${response.statusCode}”);
} on ZCatalystException catch (ex) {
print(ex.toString());
}
Last Updated 2025-06-03 18:19:55 +0530 IST
Yes
No
Send your feedback to us