Can you show how to upload images in the GCP bucket while uploading in website front end using springboot
@pratikgaikwad6883 жыл бұрын
This playlist is really clear, easy to understand and helpful, thank you @CarbonRider
@dkon82884 жыл бұрын
Thank you. Can you show how to create folder in the bucket and then load the document into that folder ?
@CarbonRiderOnline4 жыл бұрын
Hi @D Kon, One of the possible way is to map the google cloud storage to a VM using GCS Fuse and then make use of java file API to interact with it.
@dkon82884 жыл бұрын
CarbonRider thank you
@manueljaramillooporto61202 жыл бұрын
how can I change the metadata type? to text/csv for example, not the default application/octet-stream. THANK YOU
@CarbonRiderOnline2 жыл бұрын
You can do that using setContentType method available on BlobInfo object.
@rjcdz063 жыл бұрын
Excellent! It is useful and clear! Thanks!
@torbendury43744 жыл бұрын
I really enjoyed your tutorial on uploading files to GC Storage, thank you! Is it also possible to upload them to a specific subdirectory in the Bucket?
@CarbonRiderOnline4 жыл бұрын
Hi @Torben, Thanks for your words. Yes, its very much possible to upload file inside a subdirectory. You can do something like this BlobId myFileBlobId = BlobId.of("mybucket", "images/mylocalimage.jpg");
@siddharthbhandari76012 жыл бұрын
I do see you haven't showed authentication part, does your bucket allow anyone to upload files?
@CarbonRiderOnline2 жыл бұрын
Hi Siddharth, Sorry, I missed to show the authentication details in this video. The bucket doesn't allow public access and it is indeed protected. The reference of the authentication JSON file was provided using following property in application.properties file spring.cloud.gcp.credentials.location=classpath:/gcp-credentials.json
@siddharthbhandari76012 жыл бұрын
@@CarbonRiderOnline can you please also help me to provide command to generate authentication in json format.
@CarbonRiderOnline2 жыл бұрын
The JSON was generated using GCP cloud console itself. It was created for service account. I do have another video about that.
@siddharthbhandari76012 жыл бұрын
@@CarbonRiderOnline can you please share link with me
@CarbonRiderOnline2 жыл бұрын
Here you go ----- Creating service account kzbin.info/www/bejne/Zl7GhJKnfpWLeac ---- Assign role to service account kzbin.info/www/bejne/gIGTYmyYrZhmodE
@mukhammadabdullaev94763 жыл бұрын
It's really useful! Thank you! :)
@KristinaMantha4 жыл бұрын
I am getting an error on storage.create(blobInfo, data); --> seems the create method does not exist in type Storage. Do you know if something has changed?
@CarbonRiderOnline4 жыл бұрын
Kristina, The method should have worked. Please check the official documentation, it also shows and example googleapis.dev/java/google-cloud-storage/latest/com/google/cloud/storage/Storage.html#create-com.google.cloud.storage.BlobInfo-byte:A-com.google.cloud.storage.Storage.BlobTargetOption...-
@sockettofan4803 жыл бұрын
Thanks for the tutorial...Is there way to download file of any mediatype from cloud storage using spring boot?
@CarbonRiderOnline3 жыл бұрын
Yes, you can download any file.
@kirillknyazevknyazew16343 ай бұрын
How can I store GCS connection variables as environment variables. It's not safe to keep JSON file.
@CarbonRiderOnline3 ай бұрын
You shouldn't keep the JSON file inside the project source code. It can be easily be stored in Secret manager or Environment variable. If you are using docker, then you can fetch the file contents and write it to a location which can be then read by your program.
@Pedro1bc3 жыл бұрын
I'm getting java.nio.file.NoSuchFileException when trying to run it, even though the path is correct.
@bollywood90ssongs654 жыл бұрын
Can you store that file into image folder that will help us
@CarbonRiderOnline4 жыл бұрын
It can be achieved by adding the folder name in the BlobId object being constructed. BlobId.of("bucketname", "images/myfile.txt");
@chenwang34273 жыл бұрын
if the application is deployed to GCP GKE and not check in your service account json with your source code, then how do you do?
@CarbonRiderOnline3 жыл бұрын
I am note sure about GCP. But in case of AWS, there is option to assume role.
@ankitachandankar86874 жыл бұрын
I am getting an error while running an application. Error: Project ID cannot be null or empty
@ankitachandankar86874 жыл бұрын
Also I am getting an error while running Curl
@CarbonRiderOnline4 жыл бұрын
What error are you getting?
@ankitachandankar86874 жыл бұрын
@@CarbonRiderOnline Please ignore this error, it was my bad that I did not specified @RestController to my controller method.
@ankitachandankar86874 жыл бұрын
Also, could you please upload the same videos with the use of Swagger open api spec and storing file metadata into DB .
@CarbonRiderOnline4 жыл бұрын
@Ankita, using swagger and DB operations is a different topic.
@arifalimadina70914 жыл бұрын
It's taking time to upload image about 2-3 sec. Can we do it faster
@CarbonRiderOnline4 жыл бұрын
The other way is to mount the GCP storage using GCSFuse utility and use java.io.* APIs to interact with the storage. That may improve the performance.
@arifalimadina70914 жыл бұрын
@@CarbonRiderOnline any reference , any blog ?
@CarbonRiderOnline4 жыл бұрын
@Arif check this github.com/GoogleCloudPlatform/gcsfuse
@chetanchoudhary76883 жыл бұрын
do you have this project in git
@ankitachandankar86874 жыл бұрын
How you configure the Default Project ID??
@CarbonRiderOnline4 жыл бұрын
The service account json file contains reference of the project and hence you do not have to configure it.
@ankitachandankar86874 жыл бұрын
@@CarbonRiderOnline I agree that service account json file contains the reference of the project id, but, still I was getting an error that project ID cant be Null or Empty. So what I did is, I explicitly set the ProjectID variable in my application.properties file and It started running the applicattion
@CarbonRiderOnline4 жыл бұрын
@Ankita usually the project id is required by the services like GCP translation and not for storage. Can you paste the exception stack trace along with error message? Also which property did you configure in the application.properties?
@nikhillingam46302 жыл бұрын
Anyone knows how to write unit test for it
@CarbonRiderOnline2 жыл бұрын
I haven't done that. But can you be more specific as what part of GCP storage that you wish to unit test?
@nikhillingam46302 жыл бұрын
@@CarbonRiderOnline file upload/fetch/delete from google storage with java
@CarbonRiderOnline2 жыл бұрын
Is the intention to check if Google SDK APIs are working as expected? OR do you wish to check your own logic to interact with it? Ideally while writing unit test cases, you shouldn't test third party libraries (if it involves network calls or dependency on third party service).
@kousarjamadar73393 жыл бұрын
Could you please help me to upload 1Mb file TO Bucket?
@CarbonRiderOnline3 жыл бұрын
Yes, you can upload the file using the storage API.
@namratagove5372 жыл бұрын
I am getting Caused by: com.google.api.client.googleapis.json.GoogleJsonResponseException: 401 Unauthorized error
@CarbonRiderOnline2 жыл бұрын
@Namrata, can you please check if you have provided required permission to the service account? If you are reading/writing content to the existing storage bucket, then you should have "Storage object creator" role assigned to the service account.