2 years ago
#69761

user17974168
Upload Image from Android to GCS
I picked a video from Android and tried to upload it to Google Cloud Storage.
This is my code:
Uri contentURI = data.getData();
String uri = contentURI.getPath();
Storage storage = (Storage) StorageOptions.newBuilder().setProjectId("red-provider
338704").build().getService();
BlobId blobId = BlobId.of("resume-videos", "hello.mp4");
BlobInfo blobInfo = BlobInfo.newBuilder(blobId).build();
storage.create(blobInfo, Files.readAllBytes(Paths.get(uri)));
When I run this code, I get a NoSuchFileException. Could you please help me on this?
android
file
google-cloud-platform
google-cloud-storage
uri
0 Answers
Your Answer