Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

how to send images to storage using Admin Sdk in java

String file_path = file.getPath();
InputStream file_input_stream = new FileInputStream(file_path);

BlobId blobId = BlobId.of(bucket, folder+"/"+blobName);
System.out.println("Blob Id:"+blobId);
BlobInfo blobInfo = BlobInfo
            .newBuilder(blobId)
            .setContentType("application/pdf")              
            .build();
Blob blob = storage.create(blobInfo, file_input_stream.readAllBytes());
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #send #images #storage #Admin #Sdk #java
ADD COMMENT
Topic
Name
1+5 =