Upload Images / Files to Firebase In React - Firebase V9 File Upload Tutorial

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

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

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

    Just adding extra timestamps for me in the future:
    1:40 Firestore & project setup
    4:10 Neccesary packages
    5:00 Storage - get started
    6:30 Firebase configuration
    Working in the React app
    8:30 Adding file input and btns
    11:23 Uploading an image(firebase code)
    13:25 Randomize image name
    14:50 Upload the image to firebase
    16:48 How storage works
    17:20 Display all images in the React app
    23:25 Show new uploaded images automatically

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

    This was so much easier to understand than the official documentation. Thank you

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

    Dude, really appreciate the approach. You are a clear-spoken and intelligent individual. Keep it up!

  • @Human_Evolution-
    @Human_Evolution- 2 ปีที่แล้ว +4

    This is the best video on the very basics. A part 2 with a orderBy and delete option would be OP AF.

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

    Pedro tech I followed all your firebase tutorial they r all BANGERS I LOVE YOU

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

    I haven’t even watched the video but I’m so excited! My favourite tech TH-cam just released the tutorial I’ve been waiting for 🙌🏻

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

    you are amazing , clear and concise , i have not seen other tutorial that focuses just on the logic and not building unnecessary frontend stuffs . i can always keep my code original and make extension to more ideas . In short , your way of teaching is pure and phenonmenol.

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

    I used cloudinary on my First project and it was little tedious ,and I was so frustrated to do it again on my second project , And thanks to U I finished my img upload functionality on my second project with no hassles , THAANKS bro

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

    thanks for the short clear video ,nice ,straight to the point no coners

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

    Wow, really nailed the ball with this one, just about to start a project with image file uploading to Firebase. Thanks mate

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

    This is the video which one need now my situation. Thanks bruh by the way I am new subscriber of you channel.

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

    This is perfect. I was just about to add image uploading functionality to my project. Thanks Pedro!

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

      Glad it was helpful!

    • @dvlnx.
      @dvlnx. 2 ปีที่แล้ว

      @@PedroTechnologies it didnt work

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

    thank you very much for this simple project which helps to easily understand the basic concepts behind the upload process to firebase, I've just recently watched a video to do with this subject, it was simply a nightmare comparing to this one, it was like running without learning to walk :), huge thanks again

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

    If anyone needs here is the useEffect code that wont add extra images on refresh :
    useEffect(() => {
    const fetchImages = async () => {
    let result = await listAll(imageListRef);
    let urlPromises = result.items.map((imageRef) => getDownloadURL(imageRef));
    return Promise.all(urlPromises);
    };
    const loadImages = async () => {
    const urls = await fetchImages();
    setImageList(urls);
    };
    loadImages();
    }, []);

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

    Thanks Pedro, of course i will leave the like, its the least i can do for this great content.
    Thanks again from Brazil!

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

    You’re a life saver, you can’t imagine how happy I am😂

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

    Thank you Pedro. Been looking for a video like this for a while now.

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

    Thanks Pedro, great video! I have just explored you, I will continue following your videos.

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

    i really love watching your LEGENDARY videos with awsome explainaton

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

    Hey Pedro, I love watching your tutorials. They are easy to follow and explained quite well.
    I just had another request, like can you please also make videos on some popular NPM libraries and how to use them in our codebase. That would really be helpful for a lot of people like me who rely on NPM libraries on a daily basis but can't find enough tutorials to fully understand their usage.

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

    Thank you so so much for this! You manage to make things super clear and easy to understand and it's just great. Thanks again :)

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

    This is very useful thank you.
    But how would you upload images for specific items? Let's say that you want to allow users to upload products to the app, product should have a name, price, size and Image. So you create the form and connect it to Firebase database and uploads work fine for strings but with files (images) it's different. So how to connect the storage with code and with specific items in firebase?

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

      I would like this too Hey Pedro would you spare time to make this video i would be very greatful

    • @Ja-rz9fq
      @Ja-rz9fq ปีที่แล้ว

      The key is to use storage just as that - storage, so you upload image to firebase storage and then use the URL and put it in your actual database. Lets say you have Postgresql database and in your app you have a feature to share Posts, so you have Post table in your database, in that table you store values like: id, postName, postCreatedAt... and you also can add postImage and in postImage you store the link to an image stored in firebase storage

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

    hi guy! Thank u so much. This is so much easier to understand than the official docs.

  • @Amey-sn3eb
    @Amey-sn3eb 2 ปีที่แล้ว +1

    I have a problem with object creation shown on 20:07 timeline of video. Whenever a new image is uploaded a different object is created instead of incrementing the key of the existing object. Please help me with this problem.

  • @Andreas-hy7ob
    @Andreas-hy7ob 2 ปีที่แล้ว

    This was really well explained, its clear to see you got a passion! Keep going at it man, its truely great!

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

    this is the video I've been looking for, just simple, easy to understand, thank you

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

    Thanks!

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

    this is the best video on the planet! why use drive api when you can do the same but in the easiest way possible🤩

  • @md.nayeemhasanadil5938
    @md.nayeemhasanadil5938 2 ปีที่แล้ว

    Thanks so much a very good description. I was mixing up everything but your explanation was very fruitful

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

    Straight to the point, thanks Padro!

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

    You are my role model, thank you for this tutorial Pedro ;)

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

    Upload image - 15:33
    Retrieve image - 21:35

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

    I really loved your video!! Thank you for uploading this, it really helped me.

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

    Thankyou @PedroTech for this awesome video, it would be nice if you could make a video on how to make sub collections(nested collections) in firebase v9

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

    Awesome explanation 👏 👌 👍
    Nice one bro. Caps in the air

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

    Great video, thanks! I had the pdf file getting doubled up in the loop. Removed Strict mode in index.js, that fixed it.

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

    Fantastic video and explaination of how to interact with firebase while using React. Thank you :)

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

    i followed your guide and it work very well, except there is one thing. The image keeps being duplicated many time. Any fix for this. I have checked all the code in your video but no clue.

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

    If you want upload personal image and download personal image you can use
    const imagesListRef = ref(storage, `images/${user.uid}`);
    or
    const imagesListRef = ref(storage, `images/${auth.currentUser.uid}`);
    but first you must do "Sıgn In" and "Sıgn Out" medhod in reactjs with firebase
    and
    useEffect(() => {
    if (user.uid) {
    const imagesListRef = ref(storage, `images/${user.uid}`);
    listAll(imagesListRef).then((response) => {
    response.items.forEach((item) => {
    getDownloadURL(item).then((url) => {
    setImageList((prev) => [...prev, url]);
    });
    });
    });
    } else {
    return;
    }
    }, [user]);
    your useeffect must be like that becaouse when your page loading user accaount or auth progress not finished. Your useEffect must be relative to "user" or relative to "auth"

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

    Exactly what i was looking for. Great explanation. Thank you

  • @HI-ks4pr
    @HI-ks4pr 2 ปีที่แล้ว

    非常に分かりやすく、学習の助けになりました。ありがとうございます。

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

    Hello Pedro , I say that file upload but " many file inputs " in reactjs with using storage and save url firestore .

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

    Thanks for this PedroTech. This is subarashi.

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

    Thanks i was looking for how to upload files to firebase. i think u should change your vs code theme 🙂

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

      Happy to hear hahaha I still am using the same one because I started making a course using it so im only going change it when I am done with my course

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

    Great brother❤️❤️ keep it up. I am your new subscriber❤️

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

    this was awesome thanks for making this. keep making this helpful content 👌👍🙏

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

    Very good tutorial, you give the pieces to create a cool personal project. Thanks!

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

    I'm so happy I came across your channel. I've been searching for videos on various aspects of firebase. Thanks man. Don't know if you mind doing a video on how to link stripe payment gateway to firebase. I'm planning on creating a dummy e-commerce site for my portfolio, and would like to integrate a payment gateway. I tried to get tutorials how to do it, but they are quite confusing.

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

      Still on the payment integration, I noticed most of the tutorials I saw on stripe integration all had to do about firebase cloud functions. Is that the only way to integrate stripe to a web app?

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

    i HAve updated the rules section but after running the app it is showing warning of " Missing Permission " due to firestore , and every time i run the app , a dialog box appears showing this and i need to close that then i am able to access the app , if it keeps that wway then i think it will have problems in deploying the app

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

    u can also put imageList as dependency of useEffect so that the page refreshes as new files are uploaded right?

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

    Another awesome video. Really useful for my new project.
    Could you please do a video on pagination using firestore?

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

    yo yo all i have to say is I love you and thank you for this!!!!!!!

  • @Joseph-do9ue
    @Joseph-do9ue 2 ปีที่แล้ว

    Thank you very much man, your videos are the best in the youtube

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

    your are by far the best on TH-cam. Just have a question. Is it possible to do this without using firebase?

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

    what if i want to have a search bar for the user to search for a specific file and then display that file. how can i do that
    Thanks

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

    PEDRO TO 100K LETS GO

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

    Thanks for this wonderful tutorial. Very clean

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

    sir g zindabad.. wada wada laav u hogya e qasmay

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

    This helped me a lot. Thank you very much!

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

    Thanks a lot. Very clear and easy to understand.

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

    amzing explanation and perfectly structured steps.

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

    Hey guys, my useeffect that is used to get the image URLs seems to be firing multiple times, and im getting the error "React Hook useEffect has a missing dependency: 'imageListRef'. Either include it or remove the dependency array."
    Any fixes? thanks

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

      This seems like an eslint error! Try either disabling it or adding the single line disable

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

    This is amazingly perfect!

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

    Please Will you make a video on how to send data and files to firebase from one js file.

  • @TC-gv9fs
    @TC-gv9fs 2 ปีที่แล้ว +1

    Hello Pedro thanks for the video, What if I want to upload multiple images at ones ?

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

    Thanks Man. I appreciate your videos

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

    i implemented this on next js it work thanks alot dear

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

    Thankyou so much brother. It helped me a lot.

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

    After installing firebase uuid i am geting this error
    Compiled with problems:X
    ERROR in ./node_modules/firebase/dist/index.esm.js
    Module build failed (from ./node_modules/source-map-loader/dist/cjs.js):
    Error: ENOENT: no such file or directory, open 'E:\e-buddy-for-rescued-child-labour\ebuddy-portal
    ode_modules\firebase\dist\index.esm.js'
    please suggest some solution.

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

    Bro you just gave me a new idea about my new API project......

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

    This is really awesome, it would be wonderful if you can demo how firebase push notification work 🥰

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

    Thank you for the video. Btw, can anyone tell me how to link some data to that particular upload (like name, date uploaded, etc) please.

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

    QUESTION: Can I save an image file directly to firebase using an URL? Or do I need to download it to localStorage first and then back up? I am making app using Dalle2 images which generates image URLs which only last a few hours. Thanks!

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

    clear and easy to understand, thanks

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

    Thank you so much Mr. Pedro.

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

    will there be a tutorial with using react, node, express and mysql? would appreciate it

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

    Lovely demonstration

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

    Hey Pedro i had a question that i understand how to add image in firebase storage but will you please tell that how to reference a particular image to a particular document of firestore dynamically ?

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

    Thankss for explantion. So clear!!

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

    Thank you! Would like to know if you can include sending an excel file to the backend (fire base or any) and validate its extension and size

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

    Super class bro 🔥

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

    fabulous job man

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

    Google should learn from you regarding How to do the documentation.. Make it simple please, Google, like PedroTech!:)

  • @RyanBlair-xh2sy
    @RyanBlair-xh2sy ปีที่แล้ว

    Hey thanks for the great videos!! I was wondering if you could show how to store the link to the image in a firestore database

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

    Nice one. Great content.

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

    when I console.log(response) I am getting 2 times for the same array. That causes the problem of displaying every image 2 times on the screen. Any idea how can I fix this ?

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

      Same, any help?

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

      @@raydelara7185 i contacted with firebase support they have no idea.

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

      the problem is React.StrictMode which causes useEffect to be fired twice in development mode
      remove from index.js and it works as intended

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

      @@christofstanits that worked thank you . Do you know that I am not using React.StrictMode will cause any problem later ?

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

      @@utkumattaktas7994 react strictmode is to check for impure functions. This one is a bit of an edge case, because the function fires twice before the fetch happens.
      if you want to keep strictmode, search "Async Function Adding Elements Twice to an Array in React" on stackoverflow.
      (youtube wont let me post the link)

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

    Hi I have an issue regarding the listAll() method. When ever I use that method it re-renders all the codes multiple times, as a result it saves a duplicate of each downloadUrl.

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

    Thanks bro! God bless you.

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

    Please make a video about Firebase security!!!!!!!! Please

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

    Great Stuff, what if only want to show the image I just upload and use it as profile picture. I will be glad if you give me an answer to that

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

    Thanks.. Can i do the same thing with async await?

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

    감사합니다 덕분에 기능 구현했습니다.
    nextjs 를 사용하고 있는데, 리액트에서는 에러가 안나는데 nextjs에서는
    is not a function .. 이런 에러가 나서 찾아보니,
    firebase 9.4.0 으로 설치하니 완벽히 해결되었습니다.

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

    Great!! Regards from Brasil :)

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

    Hey Pedro, would you consider making a video on caching firestore data so we make less api calls? & use firestore & identity platform from gcp?

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

    thanks, I understand, and its works !

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

    I tried going through both the docs and your video but for some reason i can't display the images from the results of the download link function...though when i paste the url i get from the download link function the image downloads ...so i am not sure whats happening..

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

    a very helpful video. Thank you

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

    Hello Pedro. How can i do to list all if I have several folders in my firebase storage, each with several pictures?

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

    hi @pedrotech , great turorial!
    the images a still in double even if i refresh the page. how can i fix this?

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

    When I ran it, it just kept feeding more images like the state was stuck in a loop. Luckily not uploading extra images, just presenting extra. Like infinite list level extra.

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

      any fix for this? same here