How to Upload Images in ReactJS using Cloudinary Tutorial

Sdílet
Vložit
  • čas přidán 14. 10. 2020
  • In this video I teach you guys how to Upload Images in ReactJS using Cloudinary. The cloudinary API allows easy upload of images, videos, and files to the cloud. We also use Cloudinary-React, which allows us to grap the images very easily.
    -
    Please leave a comment on what topic you guys want me to cover next!
    Checkout my discord for any questions: / discord
    -
    SUBSCRIBE!
    Social
    ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
    Website: machadopedro.com
    Twitter: / pedrotech_
    Linkedin: / machadop1407
    Instagram: / _pedro.machado_
    Github: github.com/machadop1407
    Email: machadop1407@gmail.com
  • Věda a technologie

Komentáře • 121

  • @belcha
    @belcha Před měsícem +1

    I didn't use exactly what you showed in the video, but it helped me understand the missing piece to make my code work. Thanks!

  • @valencia375x
    @valencia375x Před 2 lety

    Thank you so much fr this tutorial. I've been searching for ways to use Cloudinary with NextJS and most tutorials out there use a complicated process. Your explanation is by far the best.

  • @studio42dev8
    @studio42dev8 Před 2 lety +10

    Thanks a million for uploading this. I've been trying to upload an image from an admin portal then store the returned URL in my database. I spent entirely too much time over the last week trying to figure it out with the confusing Cloudinary docs. You explained in 9 minutes what I couldn't find out from the docs in a week.

  • @pearlsswine
    @pearlsswine Před 3 lety +4

    THANK YOU SO MUCH! I've been clawing my eyes out trying to figure out how to use Cloudinary and this tutorial made it look like a breeze! THanks!

  • @prt2338
    @prt2338 Před 2 lety

    Finally this is what I was looking for, u da man!

  • @ThColinPereira
    @ThColinPereira Před 3 lety

    this was really helpful, thanks pedro

  • @whatever.username
    @whatever.username Před 2 měsíci

    thanks so much for the simple explanation! My teachers wouldn't help so I was so close to tears and stressed out. Because the project due date was so soon and I was wasting an entire day trying to figure this out. I just can't thank you enough.

  • @omotehinseelvis9845
    @omotehinseelvis9845 Před 9 měsíci

    Thanks Pedro, this was so helpful

  • @pidiev
    @pidiev Před 7 měsíci +1

    I used this trice now in 3 different projects. This video saved my ass a couple of times. Thanks a lot :)

  • @mistysam6645
    @mistysam6645 Před 5 měsíci

    thanks you Pedro, that was really helpful 👏

  • @noobdev4181
    @noobdev4181 Před 2 lety

    Thanks @pedroTech, this help me alot. Liked.

  • @acelmomentcand3723
    @acelmomentcand3723 Před 3 lety +3

    Very clean tutorial. Congrats!

  • @LuisTal1ercio
    @LuisTal1ercio Před rokem

    simple and effective, thank you

  • @justanaverageguy4739
    @justanaverageguy4739 Před 2 lety

    *Thank you sir. It was too helpful*

  • @Lelouchvv
    @Lelouchvv Před 2 lety

    really helpful!!! thank you very much

  • @newprof5583
    @newprof5583 Před 2 lety +1

    how can you set an image preview once you select a file before you actually upload the image

  • @AnibalGutierrezYoSoy
    @AnibalGutierrezYoSoy Před rokem

    Gracias Pedro!!! Sos un crack! Me suscribo.

  • @nmteg
    @nmteg Před 2 lety

    Hi, your video helped me, thanks!

  • @fabichasola
    @fabichasola Před 3 lety +1

    Hi! Thank you so much, excellent explanation!

  • @Cloudinary
    @Cloudinary Před 3 lety +3

    Love the video! 🙌

  • @23LS023
    @23LS023 Před 2 lety

    Thank you it was very useful

  • @shervono1180
    @shervono1180 Před 2 lety

    Hi I love ur videos. But in the line 27, I used the exact same thing but it shows an error: Argument of type 'File' is not assignable to parameter of type 'SetStateAction'.
    Type 'File' is not assignable to type 'string'

  • @aniketpandey62
    @aniketpandey62 Před rokem

    Thanks for uploading this.

  • @ossamaelidrissi2624
    @ossamaelidrissi2624 Před 2 lety

    Thanks for the video
    Question : I have a problem when i upload the images , it dosen't store in the folder , i'm using next.js

  • @minlapyae1562
    @minlapyae1562 Před 3 lety +1

    Love it ! ❤️

  • @koketjosethobja1960
    @koketjosethobja1960 Před 2 lety

    Thank you so much. How can I retrieve or store the image's url in the database?

  • @jasonhuang4333
    @jasonhuang4333 Před 2 lety

    Thank you a lot sir.

  • @jackotaru
    @jackotaru Před 2 lety

    Pedro you ROCK!

  • @Weeb940
    @Weeb940 Před 5 měsíci

    goog job you did it Bro

  • @kirayamato7875
    @kirayamato7875 Před 2 lety

    Bro...how to upload file excell... i got error if i upload excell file but if i upload img,pdf no problem with that

  • @ruona2133
    @ruona2133 Před rokem +1

    thanks for this video pedro, it's really helpful..can you please make a video on how to save the image to the database so that we don't have to keep copying the url whenever we want to display the picture?
    it'll be really helpful. thanks

  • @kira15318
    @kira15318 Před rokem

    Thank you sir

  • @lutafun
    @lutafun Před 2 lety +1

    I'm not sure why but when I place the image file input in , post to cloudinary fails(nothing happens in network tab) so I just use it without and it works. Thanks Pedro! You're my saviour

    • @mayowafalomo1399
      @mayowafalomo1399 Před rokem

      I ran into this same issue too but i've figured it out

  • @khandoor7228
    @khandoor7228 Před 3 lety +1

    new subscriber digging your content.

  • @darthvadeth6290
    @darthvadeth6290 Před 3 lety +3

    Thanks for the tutorial.
    Question: If I want to make an album display program, how can I query for all the images with a specific attribute? Surely there's a way to query for all images and display them, instead of just copy-pasting the IDs for each? (Perhaps even sort them by name?)

    • @PedroTechnologies
      @PedroTechnologies  Před 3 lety

      Hey, so what I do is I store the id in a db and use that when I want to display many images!

    • @Bogdan79Eazy
      @Bogdan79Eazy Před 2 lety

      @@PedroTechnologies how can I get the url as a response?

    • @abdel-rahmanmostafa5786
      @abdel-rahmanmostafa5786 Před 2 lety

      @@Bogdan79Eazy By accessing data.secure_url. Hope you find that way

    • @snehaparab2638
      @snehaparab2638 Před 2 lety +1

      @@PedroTechnologies how to fetch the id for all images from the cloudinary?

    • @LifeWithRilla
      @LifeWithRilla Před 10 měsíci

      @@abdel-rahmanmostafa5786I’m going to work on this tomorrow. I’m working on a post feature for an app. I just discovered this but I’m hoping the upload api endpoint provides the Id in the 200 response so I can make a secondary call to save the image id to my posts database table.

  • @dinizec
    @dinizec Před 3 lety +4

    Hey Pedro, why do we need the cloudinary extension? why not just import the image normally since we already have the url?

    • @PedroTechnologies
      @PedroTechnologies  Před 3 lety +1

      Hey, I actually don't remember why I installed the extension. But I don't thihnk it is necessary!

  • @gabrielmachado6244
    @gabrielmachado6244 Před 2 lety

    teria como enviar mais de 1 por vez? to tentando e só caio em erros...

  • @shubhamsinghvi9338
    @shubhamsinghvi9338 Před 2 lety

    I got CORS issue... how to overcome that ?

  • @pjguitar15
    @pjguitar15 Před 3 lety +1

    How do you implement progress bars when uploading a file in cloudinary?

    • @PedroTechnologies
      @PedroTechnologies  Před 3 lety

      Progress bars are usually fake, so you can just add one that starts and finished when the upload is complete. I have a video on making a progress bar!

  • @eudeamonism
    @eudeamonism Před 10 měsíci

    @Pedro After your submit, Cloudinary returns a response object. In that object, you have a secure_url. Can you show us how to utilize the delete_Token?

  • @Importunity
    @Importunity Před 3 lety +1

    what extension are you using? my vscode doesnt show the tip above like that

    • @PedroTechnologies
      @PedroTechnologies  Před 3 lety

      Hey, I believe the one your talking about is called Import Cost. I have a video on all the extensions I use: czcams.com/video/RkvFfphrVmc/video.html

  • @nyashamusanhu541
    @nyashamusanhu541 Před 3 lety

    Hello Pedro. I can post my docx and pdf files to cloudinary, but how can I extract them from there maybe as a URL or link which I can click and download in my React.js app. Thanks, I follow all your videos ...all the way from South Africa.

  • @shermainelim197
    @shermainelim197 Před 9 měsíci

    do u have a tutorial where we can upload multiple images in 1 post upload?

  • @yaroslavoz
    @yaroslavoz Před rokem

    Thanks for the guide. But I didn't get why you hardcoded the properties of an Image component?

  • @pipofighter
    @pipofighter Před 3 lety +1

    hey man, i can't get to upload different pictures within the same state, is there any way you can help me with this ?

  • @hammudi6790
    @hammudi6790 Před 9 dny

    would this also work for pdf files?

  • @loveforrebellion6269
    @loveforrebellion6269 Před 3 lety +1

    Obrigado mano

  • @doodlewooodle
    @doodlewooodle Před rokem

    What is the name of vs code theme?

  • @hakanaki
    @hakanaki Před rokem

    it is safe to expose the preset on the client ??

  • @LifeWithRilla
    @LifeWithRilla Před 10 měsíci +1

    Is the image link provided as a response from the api? I need a way to store those links on my database automatically via a secondary api request to my database.

    • @luckyugochukwuuzukwu1810
      @luckyugochukwuuzukwu1810 Před 2 měsíci

      Hi Rilla , did you find answer to this ?

    • @LifeWithRilla
      @LifeWithRilla Před 2 měsíci

      @@luckyugochukwuuzukwu1810 I took the link it provides and made a secondary api request and stored the link as the imgSrc in my database so i could recall it any time i need it.

    • @LifeWithRilla
      @LifeWithRilla Před 2 měsíci

      @@luckyugochukwuuzukwu1810 So I pretty much gave the answer in my comment haha... I just posted that response link as a post request to my database anytime a new image is uploaded.

    • @luckyugochukwuuzukwu1810
      @luckyugochukwuuzukwu1810 Před 2 měsíci

      @@LifeWithRilla thanks for replying. I figured , I do all my uploading on the server side so easy to handle , just curious on how it scaled for you using cloudinary(Basic Offer) as an upload service for your application and if your application is used for high rate upload operations?

    • @LifeWithRilla
      @LifeWithRilla Před 2 měsíci

      @@luckyugochukwuuzukwu1810 It's not this was just a personal project so for a large scale production project i would probably use something else.

  • @khoilam7569
    @khoilam7569 Před 2 lety

    how can upload file blog to cloudinary bro

  • @Dadaadad268
    @Dadaadad268 Před 3 lety +1

    Just noticed that the API url you can actually copy directly from Cloudinary in the account details dropdown to save typing it :)

  • @gabrielfono844
    @gabrielfono844 Před 3 lety +1

    Damn pedro
    I was building my startup idea amd didnt want to build any backend and database.
    I was looking for a service that would help me store videos && images for free
    and use their api to retrieve all my data
    I will just use the sane logic for video.
    I guess they have a package for video in react.
    Thanks bro

    • @PedroTechnologies
      @PedroTechnologies  Před 3 lety

      That is awesome! I am glad you found it useful! I was also amazed with Cloudinary services as I was previously using AWS S3 and it did have a cost. Cloudinary also serves videos!

    • @gabrielfono844
      @gabrielfono844 Před 3 lety

      @@PedroTechnologies thanks
      I am currently looking up the package

  • @h_nooh7390
    @h_nooh7390 Před 2 lety

    thanks a lot

  • @chifachelly402
    @chifachelly402 Před 3 lety +1

    Hello pedro! am thinking about using firebase storage as an image hosting service in my react app. Am using MySql.
    What do u think?

    • @PedroTechnologies
      @PedroTechnologies  Před 3 lety +1

      I have never used it so I can't vouch for it, but I have stored images before in GCP which is also a google service and I loved it. So it should probably work!

    • @chifachelly402
      @chifachelly402 Před 3 lety

      @@PedroTechnologies I ll giv it a try, thank u ^^

  • @cebaios
    @cebaios Před 2 lety

    Gracias!!!! Me salvaste la vida. You are a fucking genius

  • @jadhavgaurav7593
    @jadhavgaurav7593 Před rokem

    Brother 😍🔥

  • @danielobare8561
    @danielobare8561 Před rokem

    hey Pedro...can you do a video on how to implement send grid

  • @eyout7973
    @eyout7973 Před 2 lety

    👌👌

  • @voytko1994
    @voytko1994 Před 2 lety +2

    Thank you, Pedro, But how can I dynamicly get url of image?

    • @faizaanfazal1296
      @faizaanfazal1296 Před rokem

      yes just store the response in variable it returns url i suppose

  • @you3667
    @you3667 Před 3 lety

    great

  • @gauravpatil6704
    @gauravpatil6704 Před 2 lety

    How to upload multiple images?

  • @kalahari8295
    @kalahari8295 Před rokem

    Edit the video title to Include something about consuming cloudinary api in react. May drive audience

  • @tedmosby1900
    @tedmosby1900 Před 3 lety +1

    I needed this! Is cloudinary better than S3 or GCP?

    • @PedroTechnologies
      @PedroTechnologies  Před 3 lety

      Awesome! S3 is for more scalable projects. Cloudinary can also scale, but it also allows you to be able to easily transform images and process videos. Cloudinary also has a free tier which is awesome!

  • @anandhukraju8044
    @anandhukraju8044 Před 2 lety

    Cant people just get the preset from the client side

  • @yasminamran5
    @yasminamran5 Před rokem

    I keep getting cors error

  • @benjaf9408
    @benjaf9408 Před 2 lety

    How can we achieve this for multiple images upload?

    • @beaandtheo2838
      @beaandtheo2838 Před 2 lety

      Store the images array in an images state
      Then use .forEach() to iterate over the images array and at each image upload to cloudinary:
      const [images, setImages] = useState(null)
      //upload function
      function upload() {
      images.forEach(image => {
      //cloudinary upload or whatever you want to do goes in here
      })
      }
      //when file input changes:
      setImages(event.target.files)}
      //onClick in submit button

  • @Rahalbro
    @Rahalbro Před 3 lety +1

    100% good video

  • @juanhedderich
    @juanhedderich Před rokem

    Gracisa senor

  • @amoskinyera2487
    @amoskinyera2487 Před 2 lety

    Hi, how to delete images from Cloudinary thanks

  • @yasminamran5
    @yasminamran5 Před rokem

    I keep geting core error

  • @alfieqashwa5257
    @alfieqashwa5257 Před 3 lety +3

    You just need public_id only for cloudinary_react.

  • @eggxecution
    @eggxecution Před rokem

    but how to map it in react

    • @eggxecution
      @eggxecution Před rokem

      use the url that is automatically generated when you uploaded it in mongo db and cloudinary

  • @RVKAWAAA
    @RVKAWAAA Před 3 lety

    Hello,great tutorial....but sir...how can i get all images? For example if a client want a gallery or a crud? How can get all of those.?

    • @RVKAWAAA
      @RVKAWAAA Před 3 lety

      I mean...a map

    • @gowgowgaga
      @gowgowgaga Před 2 lety +1

      save the URLs in an array in a database or something when you upload them and then map through the list of URLs in the client when you need them.

  • @shiveysingh5822
    @shiveysingh5822 Před 3 lety

    hey can you make a video showing how you save that image url to a mongodb creating the schema and everything very good video thank you very much

    • @chill-_-839
      @chill-_-839 Před 3 lety +2

      Unlike what's shown in this video, you can view the image by a full image url. Typically when I save the image to cloudinary from the server, in the response object, you get access to the full public url. Then when saving a new object in mongodb with mongoose, have a property be a string type that holds this public URL like
      {
      PostComment: { type: String } ,
      PostPicture: { type: String }
      }

    • @loogie5679
      @loogie5679 Před 3 lety

      @@chill-_-839 thank you !

    • @jiwachhetri4165
      @jiwachhetri4165 Před 2 lety

      @@chill-_-839 nice

    • @caseyelliscwellis4577
      @caseyelliscwellis4577 Před rokem

      @@chill-_-839 this is a long shot since this is a year old comment, but could you post an example of this to github?

  • @MsRitika1990
    @MsRitika1990 Před 3 lety +1

    Hi I am getting 400 bad request. I have used Mysql and nodejs which is perfectly working with get method

    • @PedroTechnologies
      @PedroTechnologies  Před 3 lety

      Interesting, did you create a separate account in cloudinary?

  • @christianherrero3778
    @christianherrero3778 Před 2 lety

    Hablas ingles de locos!

  • @danielvrbka1135
    @danielvrbka1135 Před 3 lety +1

    Nice video, but I think you can skip basics in later videos. I think most of the people who are trying to learn this already know what is event and similar basic stuff. As you usualy dont start with uploading images as developer.

    • @PedroTechnologies
      @PedroTechnologies  Před 3 lety +4

      Glad you liked it! I like to explain everything cause I remember hating when tutorials assumed I knew something when I was learning. But on more advanced topics I kinda jump over the basic stuff!

    • @ebernard2
      @ebernard2 Před rokem

      @@PedroTechnologies I was really glad that you included that stuff.