How to upload image in React js Mongo db and node. Display image from Mongo. Convert image to Base64

Sdílet
Vložit
  • čas přidán 19. 02. 2023
  • Hello Guys,
    Check out this amazing cloud platform:
    ZEGOCLOUD SDK provides easy video call SDK, voice call SDK, live streaming SDK and chat SDK for real-time interaction.
    Get ZEGOCLOUD SDK for 10,000 free mins: bit.ly/3OznGu6
    Pre-built UIKits in low codes: bit.ly/3SN4Ja1
    Create docs sites with Docuo now: bit.ly/3SOF5S0
    Top 10 video conferencing SDKs for you: bit.ly/3Sx6mHg
    #zegocloud #uikits #sdk #api #react
    In this tutorial I have shown you that how can you upload an Image from react to mongo db by creating an api in node js and fetch it again and show it to your React Js application.
    Thank You.
    Node Js and Mongo Db tutorial.
    • #1 Explanation about h...
  • Věda a technologie

Komentáře • 116

  • @michellejanay4704
    @michellejanay4704 Před rokem +3

    Great, straightforward explanation! Thank you so much!

  • @maazshaikh2953
    @maazshaikh2953 Před 4 měsíci +1

    Thanks a lot man. Searched so much for this finally understood now

  • @ApataHitz
    @ApataHitz Před rokem +2

    Just what I was looking for. Thank you.

  • @devanshkapoor3179
    @devanshkapoor3179 Před 3 dny

    Thanks a lot bro! Really helpful video and great explanation as well!

  • @rajatshukla2605
    @rajatshukla2605 Před 3 měsíci

    Thank you this was extremely helpful!!

  • @rabi7331
    @rabi7331 Před rokem

    You have great playlist for beginners that wants to learn about MERN stack 👍

  • @patelaryan0914
    @patelaryan0914 Před rokem +1

    Thanks For considering my request👍👍

  • @adi411b
    @adi411b Před rokem +1

    1k complete congrats 🎉

  • @mathewuy527
    @mathewuy527 Před 11 měsíci

    awesome tutorial new subscriber here, the upload use cases in your channel are awesome, God bless you

  • @padmanabhmalwade2750
    @padmanabhmalwade2750 Před 7 měsíci

    Very Helpful Brother Keep It Up 💯

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

    i want to thank you so much for this explanation. it help me a lot!

  • @ayush1344
    @ayush1344 Před 11 měsíci

    Amazing explanation

  • @codingforyou
    @codingforyou Před rokem

    Thankuu so much you saved me🎉

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

    Thanks man this helped a lot

    • @thedebugarena
      @thedebugarena  Před 9 měsíci +1

      Thnx Make sure to checkout other videos too.

  • @user-jf1xd3fj9o
    @user-jf1xd3fj9o Před měsícem

    Thanks for explaining in easy was!!

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

    thank you bhai ek din nikal gaya dha ise solve karne keliye tere vajah se chutkiyo me ho gaya

  • @JS_shorts_dev
    @JS_shorts_dev Před rokem

    Nice, thanks bro

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

    Thanku man ❤️

  • @ameeribrahim13
    @ameeribrahim13 Před 11 měsíci +1

    Thank you

  • @shobinsebastian7745
    @shobinsebastian7745 Před rokem +2

    Yes please do the efficient way too...

  • @erfanebrahimi2731
    @erfanebrahimi2731 Před rokem

    NICE❤

  • @muratyagc8441
    @muratyagc8441 Před 8 měsíci

    thanks

  • @nucmd1433
    @nucmd1433 Před 11 měsíci

    i don't quite understand the base64 to image conversion, base 64 will be automatically converted back to the image upon transfer and the src attribute of the img tag?

  • @EdwardYambasu
    @EdwardYambasu Před 4 měsíci

    Thanks

  • @vernevens1598
    @vernevens1598 Před 5 hodinami

    I would like to know how to download the base64 image and display it in an image tag from next image

  • @abdulmomin2243
    @abdulmomin2243 Před 11 měsíci

    CORS error on Base64 images with large image size how to fix it

  • @patelaryan0914
    @patelaryan0914 Před rokem +1

    Also need to know the efficient method (using Multer)

  • @sh44ko58
    @sh44ko58 Před rokem

    Please sir, make a video where we can storage the images like this way, but just in more efficient way, and maybe with Firebase !

    • @thedebugarena
      @thedebugarena  Před 11 měsíci

      More efficient way
      czcams.com/video/j_EAwG9Rwd4/video.html

  • @piyushrai1966
    @piyushrai1966 Před rokem

    Please do the efficient way too

  • @k.ashutoshbaitharu3964
    @k.ashutoshbaitharu3964 Před 11 měsíci +1

    Please do a video on efficient way of storing and retriving image in mern app.

  • @logesh.t9918
    @logesh.t9918 Před 5 měsíci

    how to add already having image in mangodb

  • @sajalmangal4113
    @sajalmangal4113 Před rokem

    Sir make a video on efficient approach to store images in mongo db

    • @thedebugarena
      @thedebugarena  Před 11 měsíci

      Made it
      czcams.com/video/j_EAwG9Rwd4/video.html

  • @ankanbasu7381
    @ankanbasu7381 Před rokem +1

    thanks. it's really helpful.
    and how do i serve the image directly from url ?
    for eg at 12:01, if we go to that url, i want it to display the image instead of base64. (so that inside our front end i can just do
    instead of calling the api.)
    how to do this?

    • @thedebugarena
      @thedebugarena  Před rokem

      Yes same way you can store that url in state and pass that state in src

    • @ankanbasu7381
      @ankanbasu7381 Před rokem

      @@thedebugarena no no
      I'm not talking about front end
      i want the backend to serve the image directly.
      for eg if i go to
      localhost:5000/image/xyz.png
      i can see the image xyz.png.
      how to do it ?
      😓

  • @nitugiri8872
    @nitugiri8872 Před rokem

    can you show using mysql

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

    Where you have written the choose file

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

      In ui I have created a input which will take my file and send that to backend

  • @abdulmomin2243
    @abdulmomin2243 Před 11 měsíci

    CORS error on Base64 images with large image size

  • @akeelaameer9006
    @akeelaameer9006 Před rokem

    Hi!! I need to upload and image and detect the object in it and then extract that object and download how can I connect it with the mongodb and node js.

    • @thedebugarena
      @thedebugarena  Před rokem

      Watch this video in this I have shown how to connect mongo and node with react
      czcams.com/video/8zCZqGLHQQ0/video.html

  • @investandcyclecheap4890
    @investandcyclecheap4890 Před 8 měsíci

    do you know a way to compress these on the backend? I am trying to do the same thing but my file size is ~4 mb or so for each file. It would be awesome if I could shrink it down. I unfortunately have to use PNG type because I need my background transparent

    • @thedebugarena
      @thedebugarena  Před 8 měsíci

      Better will be you use multer check the video after this in that you don't have to worry about anything.

    • @venugopal-km4hf
      @venugopal-km4hf Před 29 dny

      @@thedebugarena it's better using multer, but it is not working when using with deployed url string bro , images upolading in backend upload folder only when using localhost from client side

    • @thedebugarena
      @thedebugarena  Před 29 dny

      @@venugopal-km4hf It will work, you just have to mention that particular folder nme in which your image is uploaded as public static inside your node js code.

  • @ramodsasanga6169
    @ramodsasanga6169 Před rokem

    Failed to set the 'value' property on 'HTMLInputElement': This input element accepts a filename, which may only be programmatically set to the empty string.
    i got above error.please help me

    • @thedebugarena
      @thedebugarena  Před rokem +1

      Where you are getting this send me code ss on instagram

    • @ramodsasanga6169
      @ramodsasanga6169 Před rokem

      ​@@thedebugarena I was give an value attribute to the like this. That's why I got this error. I removed the value attribute then the error was gone.

  • @user-zp1yi9ks1z
    @user-zp1yi9ks1z Před 5 měsíci

    At last u need to refress then the image is shown there , what we can do so that we donot need to refress??

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

      I have shown that in the video but if you want you can do like this when you are uploading the image, image is uploaded successfully there call the function to get fetch the image.

  • @ayush1344
    @ayush1344 Před 11 měsíci

    brother pls make video on most efficient image storing

    • @thedebugarena
      @thedebugarena  Před 11 měsíci +1

      You can check in this playlist that video is already available

  • @yashharitash2302
    @yashharitash2302 Před 3 měsíci

    Code for this ?
    \

  • @anirbandas5852
    @anirbandas5852 Před měsícem

    thankyou sir .. but sir how to deal with pdf of large size.?

    • @thedebugarena
      @thedebugarena  Před měsícem

      For large size or large quantity this is not efficient way you can wither use multer method or stor image or pdf on firebase and then get url from there. I have made video on both this topics you can checkout that.

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

    please , is that can work for excel files?

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

      Yes it can. In react where you define file type as image you can define it onlly as file then it can take any type of file. Same goes for multer there also change file type to file it would accept all type of files.

  • @ApataHitz
    @ApataHitz Před rokem +1

    Am getting this erorr Error: request entity too large

  • @talhakhan4423
    @talhakhan4423 Před rokem +1

    i have succesfully coverted image to base64 but while saving it to mongodb i am getting this error: PayloadTooLargeError: request entity too large

    • @thedebugarena
      @thedebugarena  Před rokem

      You can increase the value in mongo db

    • @talhakhan4423
      @talhakhan4423 Před rokem

      @@thedebugarena I don't know how to increase please help me

    • @sh44ko58
      @sh44ko58 Před rokem

      @@thedebugarena but how ?

    • @sh44ko58
      @sh44ko58 Před rokem

      @@talhakhan4423 did u fixed it ?

    • @talhakhan4423
      @talhakhan4423 Před rokem

      @@sh44ko58 no bro
      I just used multer for now

  • @ayushgoel9948
    @ayushgoel9948 Před 7 měsíci

    please make another vidoe if i wanna store it on large scale?

    • @thedebugarena
      @thedebugarena  Před 7 měsíci

      You can use multer I already have a video on that.

  • @asmrjavascript_
    @asmrjavascript_ Před rokem +1

    Hiii,
    i face this error: PayloadTooLargeError: request entity too large
    how to I fix ????

    • @thedebugarena
      @thedebugarena  Před rokem +1

      You can set the limit by your own

    • @asmrjavascript_
      @asmrjavascript_ Před rokem +1

      @@thedebugarena I set limit, then show error?? Please make video this topic

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

    when i logout form the account, the image gets deleted.

  • @KadamVaibhav-gn8pw
    @KadamVaibhav-gn8pw Před 2 měsíci

    Can you share the github gipo

  • @applelemon9371
    @applelemon9371 Před 7 měsíci

    bro i got error Status Code:413 Payload Too Large, when i upload how can i fix this ?

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

      add this in your code app.use(express.json({limit: '50mb'}));

    • @applelemon9371
      @applelemon9371 Před 7 měsíci

      @@thedebugarena thx dude

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

    how to do the same for react native?

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

      Process is same and most of the coding also

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

      @@thedebugarena can you guide me plz I'm stuck on conversion from image picker to binary data

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

      @@primefindz Dm me on insta gram

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

    after adding moer than 20 product it become very slow

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

      Yes this is not the recommended one. You can try using multer

  • @kumarnishant6924
    @kumarnishant6924 Před rokem

    how i can get your code??

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

    source code

  • @vish814
    @vish814 Před 11 měsíci

    git hub ka bhi link de de yaar uska

  • @KadamVaibhav-gn8pw
    @KadamVaibhav-gn8pw Před 3 měsíci

    Or just give the codefile

  • @shridharkandikatla
    @shridharkandikatla Před rokem

    Want in effecient manner

    • @thedebugarena
      @thedebugarena  Před 11 měsíci

      More efficient way
      czcams.com/video/j_EAwG9Rwd4/video.html

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

    Dont use base 64 method.running process is slow.use firebase and generate url and .after generated url save mongo db

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

      Yaa correct this is one of the way we can use to upload image, storing the image to firebase or any cloud platform is one of the most efficient way.

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

    Your screen is tiny

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

    pls help me!!!, how can i showing off these images in my handlebars-html( it´s does wrong).
    app.post("/Data",(req,res)=>{
    const novaPostagem = {
    titulo:req.body.titulo,
    descricao:req.body.descricao,
    comentario:req.body.comentario,
    image:req.body.image
    }
    new Postagens(novaPostagem).save().then(()=>{
    console.log("salva com sucesso!!!"+ req.body.image)
    }).catch((err)=>{
    console.log("erro ao salva:"+err)
    })
    })
    {{#each Postagem}}

    {{titulo}}
    {{descricao}}



    {{else}}
    nada encontrado!!!
    {{/each}}
    the image code is save this form in my mongodb:
    image: BinData(0, 'bGy9nuyubzIuc99G5n')

  • @erfanebrahimi2731
    @erfanebrahimi2731 Před rokem

    Yes please do the efficient way too..

  • @abdulmomin2243
    @abdulmomin2243 Před 11 měsíci

    CORS error on Base64 images with large image size how to fix it

    • @thedebugarena
      @thedebugarena  Před 11 měsíci

      You can increase payload size in mongo db

    • @thedebugarena
      @thedebugarena  Před 11 měsíci

      You can increase payload size in mongo db

    • @abdulmomin2243
      @abdulmomin2243 Před 11 měsíci

      @@thedebugarena how increase payload size in mongo db

    • @abdulmomin2243
      @abdulmomin2243 Před 11 měsíci

      you can make video increase payload size in mongo db