Reputation: 33
My application running on computer engine creates images which I upload to cloud storage. This works well using
BlobInfo blobInfo =
storage.create(
BlobInfo
.newBuilder(bucketName, fileName)
.setAcl(new ArrayList<>(Arrays.asList(Acl.of(User.ofAllUsers(), Role.READER))))
.build(),
filePart.getInputStream());
But I need to upload this to specific folder like 'bucketname/170717/'
Couldn't find way to upload to specific folder. Any pointers would be appreciated.
Upvotes: 0
Views: 1095
Reputation: 33
So finally I got the solution.
storage.create( BlobInfo .newBuilder(bucketName, fileName)
In above snippet of code if fileName has a folder path, cloud storage creates it. So when I passed "images/" + fileName a new folder images was created and file was created inside that.
Upvotes: 2