Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

upload converted base64 to image object to oss without saving in java

String endpoint = "<yourEndpoint>";
String accessKeyId = "<yourAccessKeyId>";
String accessKeySecret = "<yourAccessKeySecret>";
String bucketName = "<yourBucketName>";
String yourImageName="this name of the image you want to upload";
String objectName = "this-is-path/" + yourImageName + ".png";
String bas64Img = "<base64 string>";

OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
byte byteImg[] = Base64.decodeBase64(bas64Img);

ossClient.putObject(bucketName, objectName, new ByteArrayInputStream(byteImg));
 
PREVIOUS NEXT
Tagged: #upload #converted #image #object #oss #saving #java
ADD COMMENT
Topic
Name
3+2 =