Spring Boot | File Upload and Download REST API | Store images in File System | JavaTechie

แชร์
ฝัง
  • เผยแพร่เมื่อ 25 ธ.ค. 2024

ความคิดเห็น • 105

  • @SupriyaMondal3
    @SupriyaMondal3 2 ปีที่แล้ว +13

    Thanks you for helping me to learn new features not only for this video but for all other videos .

    • @Javatechie
      @Javatechie  9 หลายเดือนก่อน

      Thanks for buying me a coffee ☺️

  • @ChandlerBing11
    @ChandlerBing11 2 ปีที่แล้ว +7

    Good content as always, Java Techie!!! Thank you so much, friend!!!

  • @emilymenchu
    @emilymenchu 9 หลายเดือนก่อน +2

    This video helped me a lot. Thank you so much for your amazing content

  • @manognajoshik8465
    @manognajoshik8465 2 ปีที่แล้ว +3

    Great content as always!! I have referred your channel to many of my friends!!

  • @hugosalvadormaldonadotapia8719
    @hugosalvadormaldonadotapia8719 8 หลายเดือนก่อน +1

    Thanks man! This tutorial is very helpful.

  • @RandomGuy-zc6ko
    @RandomGuy-zc6ko 2 ปีที่แล้ว +2

    you are a lifesaver, thank you alot.👍💪

  • @vincent-99
    @vincent-99 11 หลายเดือนก่อน +1

    Java Techie is the GOAT

    • @Javatechie
      @Javatechie  11 หลายเดือนก่อน

      Thanks buddy

  • @Rob-J-BJJ
    @Rob-J-BJJ 2 หลายเดือนก่อน +1

    very good and informative sir

  • @ismetayvazoglustudent7448
    @ismetayvazoglustudent7448 ปีที่แล้ว +1

    great tutorial. you have been very helpful thanks

  • @attitudebhakiro8302
    @attitudebhakiro8302 ปีที่แล้ว +1

    Thanks for this tutorial, it so easy to follow and to understand

  • @samirhasanov3521
    @samirhasanov3521 ปีที่แล้ว +1

    I am grateful to you, thank you very much for the lesson👋👋👋👋👋👋👋👋👋

  • @minhdo7132
    @minhdo7132 ปีที่แล้ว +1

    Thanks for the tutorial, simple and easy to follow thumb up

  • @loicgnagoh8283
    @loicgnagoh8283 2 ปีที่แล้ว +3

    great tutorial guy ! simply just like always : awesome!

  • @mahendragowda2641
    @mahendragowda2641 2 ปีที่แล้ว +1

    Thanks for this video!

  • @VaisakhanML
    @VaisakhanML 10 หลายเดือนก่อน +1

    It worked, Thanks.

  • @AshutoshMohanty07
    @AshutoshMohanty07 2 ปีที่แล้ว +1

    Wish you get to 100K subscribers soon 👍

  • @amitkumaryadav5824
    @amitkumaryadav5824 2 ปีที่แล้ว +1

    You are Amazing!

  • @muralibunny8936
    @muralibunny8936 2 ปีที่แล้ว +2

    Happy teachers day sir 🙏🏻

    • @Javatechie
      @Javatechie  2 ปีที่แล้ว

      Thanks Murali 🥰

  • @曾毓哲-b1t
    @曾毓哲-b1t ปีที่แล้ว +1

    Thank You very much

  • @shivkantgupta1378
    @shivkantgupta1378 ปีที่แล้ว

    thank sir ji
    You are a
    great

  • @abdelmoneimelshafei6570
    @abdelmoneimelshafei6570 ปีที่แล้ว

    Big thanks sir 🥰🥰🥰

  • @wondersmind3454
    @wondersmind3454 11 หลายเดือนก่อน +1

    I have a question: instead of directly passing a MultipartFile to the API, can I pass a DTO class containing a file (MultipartFile) and a serial number? This way, I'll be able to send multiple files with a sequence number. Consequently, when retrieving these files, I can arrange them in the specified sequence.

  • @carlaribeiro4206
    @carlaribeiro4206 11 หลายเดือนก่อน +1

    PERFECT!

  • @bansiloyjohnkennethc.7514
    @bansiloyjohnkennethc.7514 7 หลายเดือนก่อน

    Thank You SIr

  • @samuelmevognon6339
    @samuelmevognon6339 ปีที่แล้ว +2

    Thank you sir .Please,I want to know what would be the filePath in a production app.

    • @Javatechie
      @Javatechie  ปีที่แล้ว

      Root/folder in VM

    • @samuelmevognon6339
      @samuelmevognon6339 ปีที่แล้ว +1

      @@Javatechie Thank you ,thank you🙏🙏🙏

    • @samuelmevognon6339
      @samuelmevognon6339 ปีที่แล้ว +1

      @@Javatechie So I think that it would be better to specify the path in the application.properties file

    • @Javatechie
      @Javatechie  ปีที่แล้ว

      Yes but not in application.properties rather we can specify it in some central place like secret manager or vault or consul

    • @samuelmevognon6339
      @samuelmevognon6339 ปีที่แล้ว +1

      @@Javatechie Ok.It's clear for me, sir.Thank you.

  • @siddharthagrawal4280
    @siddharthagrawal4280 10 หลายเดือนก่อน +1

    Hey!
    I am dealing with bigger sized images ( around 10-20MB size )
    What would be best method of storing it ?
    Should it store in frontend side and give me the link of stored location? Or should it be handled at backend ?
    What would be best practice for this case?

    • @Javatechie
      @Javatechie  10 หลายเดือนก่อน

      No it needs to be handled in the backend side . Same approach i have followed

    • @siddharthagrawal4280
      @siddharthagrawal4280 10 หลายเดือนก่อน

      @@Javatechie if we upload the file from frontend, we can get the percentage of upload also right?

  • @aabhasjain96
    @aabhasjain96 9 หลายเดือนก่อน +1

    Hello Sir, Thank you so much for this valuable knowledge.
    I am creating apis for news app, there I will fetch all the news in one api call. but to store the image which approach should I follow I am confused.
    Should I directly upload it in DB or store the URL, please guide me. Thnx once again.

    • @Javatechie
      @Javatechie  9 หลายเดือนก่อน

      Follow the same approach that's feasible

    • @aabhasjain96
      @aabhasjain96 9 หลายเดือนก่อน +1

      @@Javatechie you mean this File system one, right ?

    • @Javatechie
      @Javatechie  9 หลายเดือนก่อน +1

      @@aabhasjain96 yes

  • @testers-blog5770
    @testers-blog5770 2 ปีที่แล้ว

    Hello @JavaTechie. Thanks for the great tutorial. I have question regarding test script creation for input file system where I am passing file as queryparam instead of pathparam. What would be the correct approach to test the file input(PDF file), assuming there is no repository since I am taking the input from my local path and performing internal operation on it(for example-take the file and run Post to convert PDF file to word). Kindly suggest. Thank you

  • @shaikheajajuddin8317
    @shaikheajajuddin8317 2 ปีที่แล้ว +3

    Could make video on downloading millions of data in Excel file without having outofmemory error

    • @pravindabhade185
      @pravindabhade185 2 ปีที่แล้ว +2

      You can use fastexcel api for this

  • @TheRagreis
    @TheRagreis 23 ชั่วโมงที่ผ่านมา +1

    If you want to containerize this application and use a Docker Volume, how can you do it?
    My goal is to have a containerized microservice that is capable to save uploaded files in a volume and its paths in other containerized mysql database with volume. The second part I can do it but the first I don't know how to choose the file location and create the volume. I thought that Resource location it's a good idea but I can't do it. Please HELP...

    • @Javatechie
      @Javatechie  22 ชั่วโมงที่ผ่านมา +1

      We can do this buddy , currently i am out of station is this okay if I will share the github or resources after 3 or 4 days ? You can remind me on javatechie4u@gmail.com

    • @TheRagreis
      @TheRagreis 14 ชั่วโมงที่ผ่านมา +1

      I already sent you an email. This is so important for me... Many thanks for your help! Merry Christmas

  • @rishiraj2548
    @rishiraj2548 2 ปีที่แล้ว +1

    Thanks

  • @shankarraj3606
    @shankarraj3606 ปีที่แล้ว +1

    Hello @JavaTechie, In my case it asking me to create The method Builder() is undefined for the type entity

    • @Javatechie
      @Javatechie  ปีที่แล้ว

      Configure Lombok in your idea 💡 buddy if it's intellij just install the Lombok plugin

  • @vineethchinna3951
    @vineethchinna3951 2 ปีที่แล้ว +1

    Hi sir I have a small doubt if we are storing in a file system approach. How will the retrival happen in realtime applications. My doubt is in realtime the application will be deployed in many VM's for availability reason right. first when we use to upload request to store our images it will be stored on one VM's files system and next time when try to acess the because of loadbalancing we might not hit the same VM right. in that case our image will unaccesable right. how to achieve this. Please forgive me if my queestion/my way of thinking is wrong.

    • @Javatechie
      @Javatechie  2 ปีที่แล้ว

      You need to automate directory creation in each vm . The way we are doing for logs management

    • @vineethchinna3951
      @vineethchinna3951 2 ปีที่แล้ว +1

      @@Javatechie is there any video logs in your channel sir, If yes can you please share the link I will go through t

    • @Javatechie
      @Javatechie  2 ปีที่แล้ว

      No i don't have any video regarding this buddy

    • @SamirJzVFX
      @SamirJzVFX 2 ปีที่แล้ว +1

      You can store it in the Cloud I think.

  • @jacksonemmerich
    @jacksonemmerich ปีที่แล้ว

    Hello, thank you very much for the video, can I ask a question?
    how would you store other types of files like pdf, and how do i limit the file size to be sent like 5mb.

    • @TulasiramV
      @TulasiramV ปีที่แล้ว

      spring.servlet.multipart.max-file-size=5MB
      spring.servlet.multipart.max-request-size=5MB use these properties in the application.properties

  • @ChandraSekhar-pu5ei
    @ChandraSekhar-pu5ei 2 ปีที่แล้ว +1

    Could u make a video on Swagger and how to use in microservices

    • @Javatechie
      @Javatechie  2 ปีที่แล้ว

      Already uploaded multiple videos about swagger documentation please search with keyword "documentation"

  • @kittuchowdary9599
    @kittuchowdary9599 2 ปีที่แล้ว

    Can you please make a video on how to write search operations in spring boot

  • @harithabandara3212
    @harithabandara3212 6 หลายเดือนก่อน

    thank youuu

  • @shankarraj3606
    @shankarraj3606 ปีที่แล้ว +1

    Hello @JavaTechie, I am facing the whitelable error while retrieving the image with name
    This application has no explicit mapping for /error, so you are seeing this as a fallback.

    • @Javatechie
      @Javatechie  ปีที่แล้ว

      Okay are you hitting the correct url ? Can you validate whether your server is coming up or not?

  • @MrAchilles2
    @MrAchilles2 2 ปีที่แล้ว +1

    can you please extend the video and encrypt the file on the storage (file system) so it will be secured
    then decrypt it while downloading

    • @Javatechie
      @Javatechie  2 ปีที่แล้ว +1

      Yes in image utility we have the method, you can use the same code

    • @MrAchilles2
      @MrAchilles2 2 ปีที่แล้ว

      @@Javatechie
      I mean encrypt the file so no one can open it even he accessed the storage

  • @andresgomez5592
    @andresgomez5592 4 หลายเดือนก่อน

    How to do the same but for json post request, convert it into base 64?

  • @abhisaragarwal9084
    @abhisaragarwal9084 2 ปีที่แล้ว +1

    Sir do you have videos on Rest api development from java on your channel pls give me link

    • @Javatechie
      @Javatechie  2 ปีที่แล้ว

      Yes buddy using spring boot i uploaded a couple of videos please check out my spring boot playlist

    • @abhisaragarwal9084
      @abhisaragarwal9084 2 ปีที่แล้ว

      @@Javatechie ok thnx

  • @murtazajamali5609
    @murtazajamali5609 6 หลายเดือนก่อน +1

    Can we upload video and other file type too in such way

    • @Javatechie
      @Javatechie  6 หลายเดือนก่อน +1

      Yes we can

  • @erdalhulagu4516
    @erdalhulagu4516 ปีที่แล้ว +1

    i follow your codes i used String Id instead of name on entity
    but on GetMapping it returned internal server exemption no value. if you could give a trick to fix it i would be happy

    • @Javatechie
      @Javatechie  ปีที่แล้ว

      I am not getting you . What error you are getting paste here

  • @sairajnaikdhure1112
    @sairajnaikdhure1112 11 หลายเดือนก่อน

    How can we store image on cloud and then save that file_path to database?

  • @bhavanisankar71
    @bhavanisankar71 ปีที่แล้ว +1

    Brother after insert images into db can I delete that image on my local mechine

    • @Javatechie
      @Javatechie  ปีที่แล้ว

      Yes you can while inserting only take the path and do File.delete method

    • @bhavanisankar71
      @bhavanisankar71 ปีที่แล้ว

      @@Javatechie thanks

  • @aswinbiju4038
    @aswinbiju4038 8 หลายเดือนก่อน

    Getting the following error even after increasing request size and file size.
    getting 415 unspported media type error
    the request entity has a media type which the server or resource does not support. for example the client uploads an image as image/svg+xml, but the server requires that images use a different format

  • @Ajay-xq5kz
    @Ajay-xq5kz ปีที่แล้ว

    Is their any way to store the file in server side and the storage location in database

  • @georgebanin4812
    @georgebanin4812 ปีที่แล้ว

    i used the file system approach and stored the file in the application itself but when i tried to package the file it didnt work

  • @HarshJha-n6i
    @HarshJha-n6i ปีที่แล้ว

    Hi, would like to know that how can we use this method for PDF

  • @ashishmahanta7963
    @ashishmahanta7963 ปีที่แล้ว

    How to upload list of photo..
    Please sir make a video

  • @makarandburud2909
    @makarandburud2909 2 ปีที่แล้ว

    can we use this for video upload ?

  • @rjgupta2849
    @rjgupta2849 2 ปีที่แล้ว +2

    sir please can you recreate this in mongodb

  • @himanshumaurya4046
    @himanshumaurya4046 4 หลายเดือนก่อน

    Sir after hosting the app this code doesn’t work

  • @vengateshm2122
    @vengateshm2122 2 ปีที่แล้ว

    Expecting a cloud storage solution video next time.

    • @pavanbhagathi6958
      @pavanbhagathi6958 2 ปีที่แล้ว +1

      Yes

    • @Javatechie
      @Javatechie  2 ปีที่แล้ว +2

      It's already there using S3

    • @Javatechie
      @Javatechie  2 ปีที่แล้ว

      Please check out the below 👇 link both of you th-cam.com/video/vY7c7k8xmKE/w-d-xo.html

  • @Dreamriter
    @Dreamriter 2 ปีที่แล้ว

    Can you teach us about AWS textract in spring boot

    • @Javatechie
      @Javatechie  2 ปีที่แล้ว

      Here is the playlist link please refer AWS (Amazon Web Services): th-cam.com/play/PLVz2XdJiJQxxurKT1Dqz6rmiMuZNdClqv.html

  • @AyushBhat-ud1ly
    @AyushBhat-ud1ly 10 หลายเดือนก่อน

    issue while using png image in downloadImage method response status is 200 but cant see image

    • @Javatechie
      @Javatechie  10 หลายเดือนก่อน

      No it shouldn't be any issues, are you getting any exception in logs or console?

    • @AyushBhat-ud1ly
      @AyushBhat-ud1ly 10 หลายเดือนก่อน

      no error i have just removed the compress and decompress methods
      @@Javatechie

    • @AyushBhat-ud1ly
      @AyushBhat-ud1ly 10 หลายเดือนก่อน

      @ResponseStatus(HttpStatus.FOUND)
      @GetMapping("/get-file")
      public ResponseEntity getImage(@RequestParam Long id){
      byte[] downloadImage = mediaService.downloadImage(id);
      return ResponseEntity.status(HttpStatus.OK)
      .contentType(MediaType.valueOf("image/png"))
      .body(downloadImage);
      }
      @Transactional
      public byte[] downloadImage(Long id) {
      MediaFile imageData = mediaRepository.getMediaFile(id).stream().findFirst().orElse(null);
      if (Objects.nonNull(imageData)) {
      return imageData.getFileData();
      } else {
      return new byte[]{};
      }
      }

    • @AyushBhat-ud1ly
      @AyushBhat-ud1ly 10 หลายเดือนก่อน

      .contentType(MediaType.valueOf("image/png")) this thing makes the content type static ?

  • @aswinbiju4038
    @aswinbiju4038 8 หลายเดือนก่อน

    that .builder function doesnt work for me

    • @Javatechie
      @Javatechie  8 หลายเดือนก่อน

      Please configure Lombok in your ide

    • @aswinbiju4038
      @aswinbiju4038 8 หลายเดือนก่อน

      @@Javatechie configured lombok
      Installed separate plugins
      Changed dependencies, gave all the necessary annotations
      I even imported your project from github to see if it was working but same issue with the .builder function
      It keeps saying I have to define the function

  • @btrnoob
    @btrnoob 2 ปีที่แล้ว

    how to show all images in html page

  • @AyushBhat-ud1ly
    @AyushBhat-ud1ly 10 หลายเดือนก่อน

    can anyone help with this ?

  • @coraltelecom-cp1wl
    @coraltelecom-cp1wl ปีที่แล้ว

    please help ASAP

  • @nephren4276
    @nephren4276 หลายเดือนก่อน +1

    sorry bro, i apologize

    • @Javatechie
      @Javatechie  หลายเดือนก่อน

      For what buddy?