Firebase v9 Storage in React | Upload Files to Cloud

Поділитися
Вставка
  • Опубліковано 7 січ 2025

КОМЕНТАРІ • 187

  • @jeetviramgama4392
    @jeetviramgama4392 2 роки тому +15

    It's a shame that useful videos like this one don't get more likes. Thank you very much for this.
    Edit: I just saw that you have a playlist on react firebase. Please continue what you're doing, we need more people like you.

    • @FullstackSimplified
      @FullstackSimplified  2 роки тому +1

      Thanks for your support. Really appreciate it

    • @programming_tech_zone9613
      @programming_tech_zone9613 2 роки тому +1

      Truly, this video is so nice if i had a way to support, I will not waste a thousandth of a second

  • @lokesh-webdev219
    @lokesh-webdev219 3 роки тому +2

    Cleared all the confusion in just 10 mins tutorial.
    You are a champ bro.
    You truly saved my day.
    Thank you sooo sooo much bro.

  • @michealbailey6372
    @michealbailey6372 3 роки тому +3

    This is a great video on storing images in firebase. I've been running around the internet for the past day trying to figure out how to get it done, but it seemed like all the content was out of date. This tutorial saved me a lot of trouble. Thanks again.

  • @itsrubydoyle
    @itsrubydoyle 2 роки тому +2

    I was having trouble with the Firebase documentation but this video has been so helpful! Thank you!

    • @FullstackSimplified
      @FullstackSimplified  2 роки тому +1

      Thanks for watching 🔥

    • @itsrubydoyle
      @itsrubydoyle 2 роки тому

      @anona lol Yeah I'm definitely having a lot of trouble getting things working - I haven't made much progress since this comment as it's hard to find good resources. Net Ninja has a good intro series on his channel, but it doesn't cover enough. His Udemy course has been really good, but it's also outdated. Would love to know if you find any good resources!

  • @jeffreykolenchery1872
    @jeffreykolenchery1872 3 роки тому +3

    Followed a lot of tutorials but this one finally worked! Thanks a lot!!

  • @bushcommander2205
    @bushcommander2205 2 роки тому +1

    Dude - this worked straight away which pretty much never does! :D Subscribed : )

  • @singh03ashish
    @singh03ashish 3 роки тому +2

    Happy diwali sir.... Diwali pe bhi video pe kaam... Dedication level 🔥🔥🔥

  • @jahbless8244
    @jahbless8244 2 роки тому +1

    Great video, you just saved my life, I was reading the documents and after a long time searching, I found your video.

  • @techjourneyrecoded4114
    @techjourneyrecoded4114 3 роки тому +2

    Thanks for the new video on Firebase v9. Great tutorial 🔥

  • @evanbero9705
    @evanbero9705 2 роки тому +1

    Awesome! Thank you! Man, great tutorial. I was having such a headache with v9 and combing through Firebase docs. Thank you for simplifying this. Liked and subscribed

  • @introvertedperson23
    @introvertedperson23 2 роки тому +2

    wow dude this was amazing. straight to the point and easy to follow along. much appreciated, thank you!! :)

  • @matheuslasserre6499
    @matheuslasserre6499 3 роки тому +2

    the best of the best, saved my latenight work, thank you so much!

  • @sujitgoswami3319
    @sujitgoswami3319 3 роки тому +4

    wonderful video for IT Students.

  • @marcelafelixfortis935
    @marcelafelixfortis935 3 роки тому +3

    thanks! much better than documentation!
    would love to see a version where you manipulate the metadata and also set some custom metadata

  • @omonullausmonjonov6250
    @omonullausmonjonov6250 Рік тому +1

    Bu darsdan koʻp narsa oʻrgandim rahmat kottakon

  • @tahep3906
    @tahep3906 11 місяців тому +1

    thanks a lot for covering this complex subject, it works flawlessly

  • @sissyyayle0517
    @sissyyayle0517 3 роки тому +1

    Thanks for you excelent explain! You save me on this part of my project!! Thanks again!!

  • @kritigoswami7382
    @kritigoswami7382 3 роки тому +2

    Very helpful content again 🙂

  • @thomaschalanson8643
    @thomaschalanson8643 3 роки тому +1

    Thanks very much i begin with firebase and with your tutorial it's was simple :)

  • @sujitrockstar221
    @sujitrockstar221 3 роки тому +2

    Beautiful contents useful for all IT students

  • @codemedic
    @codemedic Рік тому +1

    Thanks a lot for making this video, Its so precise and bulk with information 🎉🎉🥳🥳👍👍.

  • @danielojeda7753
    @danielojeda7753 3 роки тому +1

    Excellent video man.. Thank you

  • @DurgeshKr22
    @DurgeshKr22 3 роки тому +1

    YOU ARE A LIFE SAVER MAN!

  • @lokesh5371
    @lokesh5371 2 роки тому +1

    Thank you very much dude , it works 😀👌

  • @MetilmaXI
    @MetilmaXI 2 роки тому +1

    Very useful, thank you. I followed your video and got my test-app working in minutes & was able to use that info for my intended project!
    May I suggest you look into using a .env file to protect your firebase credentials from showing up your public github repo? I'm hesitant to leave API keys on public repos - but that's your preference.

    • @FullstackSimplified
      @FullstackSimplified  2 роки тому

      Yes surely you can use .env for firebase config. Just for the demonstration I have kept it public and since I have already deleted the project from my firebase console so any ways the api key won’t be usable. But thanks for observation. Really appreciated

  • @gulay3203
    @gulay3203 3 роки тому +1

    thank you, my app worked!

  • @acemalto4202
    @acemalto4202 2 роки тому +1

    can you make part 2 of that using downloading data in firebase

  • @knowledgegeeks3901
    @knowledgegeeks3901 2 роки тому +1

    you saved my life!
    the documentation is not clear unlike your video
    i have a question>
    what is the difference between setDoc() and the method you have used in this video

    • @FullstackSimplified
      @FullstackSimplified  2 роки тому

      Hey thanks for your feedback!! Really appreciate it.
      Coming to your question setDoc is a method used in firebase firestore (not firebase storage) to add data.

  • @ithen15
    @ithen15 2 роки тому +1

    can you make a video of listing all the elements in storage and downloading them ?

  • @immeatom
    @immeatom 3 роки тому +1

    Love the content.

  • @isuruudana3330
    @isuruudana3330 3 роки тому +1

    Thank you very much, Sir !!! you are a real lifeguard 😊😊😊

  • @Jack-ss4re
    @Jack-ss4re 2 роки тому

    10:34 I write console.log(url) and it gives me a working url in Storage, but when doesnt work when i do setImage(url), it pass a empty string, do you know why or how can i fix that?

    • @FullstackSimplified
      @FullstackSimplified  Рік тому

      Please share the code snippet for the same. It will give me more clear context on this.

  • @trapster6745
    @trapster6745 2 роки тому +1

    thank u so much for sharing, much needed

  • @kosmedsuporte
    @kosmedsuporte 3 роки тому +1

    Nice video, man !
    When you create functions, they receive some kind of yellow line, what extension is that one?

  • @alexanderpapashvili5347
    @alexanderpapashvili5347 3 роки тому +1

    good tutorial! well done

  • @olubiyioluga1584
    @olubiyioluga1584 2 роки тому +1

    I have spent up to two days trying to figure this out. T han you so much for the video. It was amazing. I do need advice, the image is being saved in the storage however it isn't displaying in the storage, its there but i xan't see the actual image. I know it has to do with the file format from expo image picker. I need to convert it to bytes, aby ideas on how to do this? Thank you

  • @mdtamizuddin4269
    @mdtamizuddin4269 2 роки тому +1

    Very useful, thank you

  • @Bayazzitt
    @Bayazzitt 2 роки тому +1

    Since there are 2 ref plugins, it gives the following error. Can you help please?
    import { set, ref, } from "firebase/database";
    import { getDownloadURL, uploadBytesResumable, ref,} from 'firebase/storage';
    Terminal : Parsing error: Identifier 'ref' has already been declared.

    • @FullstackSimplified
      @FullstackSimplified  2 роки тому +1

      You can try alias named import. Something like this
      import { set, ref as dbRef } from "firebase/database";
      import { getDownloadURL, uploadBytesResumable, ref as storageRef} from 'firebase/storage';

  • @akshaikumar7966
    @akshaikumar7966 3 роки тому +1

    thank you so much ,this helped a lot

  • @thecareercoach231
    @thecareercoach231 3 роки тому +1

    Great content 👍

  • @jknyt
    @jknyt 2 роки тому +1

    Thank you, man!

  • @kevinclayton9747
    @kevinclayton9747 2 роки тому +1

    nicely done, thank you sir

  • @AbdulQadir0097
    @AbdulQadir0097 3 роки тому +1

    Hey, this video helps me a lot, but will you please tell me how to display that picture on the web page. Like a person login from the firestore collection and authentication and how do I display his picture as a profile pic.

    • @FullstackSimplified
      @FullstackSimplified  3 роки тому

      You can store the download url of the picture in the users collection and then use it when user logs in.
      There's another way if you just want to store the img for profile picture only. You can do this by simply setting the display image for your authenticated user by updating the user profile. Follow this for more - firebase.google.com/docs/auth/web/manage-users#update_a_users_profile

  • @elendil4543
    @elendil4543 3 роки тому +1

    God bless you , thank you brother

  • @_WyreZ
    @_WyreZ 2 роки тому +1

    Awesome tutorial, thank you!
    Is it possible to access Google Cloud Storage (not Firebase Storage) using reactjs?

    • @FullstackSimplified
      @FullstackSimplified  2 роки тому +1

      Typically you need to have a Backend written where you should use google cloud storage, as using it directly in your frontend will expose you secret api keys.

    • @_WyreZ
      @_WyreZ 2 роки тому

      @@FullstackSimplified Makes sense. Thank you! :)

  • @shrishsharma8333
    @shrishsharma8333 3 роки тому +2

    Hey There, Thanks for this solution.
    But please hear me out,
    I want to post a picture along with a caption text to firestore.
    so, the imageURL will be sent to storage, and caption text to firestore.
    but i am getting errors in doing so. can you please provide some implementation to this

    • @FullstackSimplified
      @FullstackSimplified  3 роки тому +2

      You can store the image to firebase storage then get the download url. Then in the Firestore you need to store the url caption and other details you want. Then everything can be fetched from the Firestore in one go.
      Apart from this if you just want to have a caption to your image you can just update the meta data of the image with your custom metadata. Implementation can be found here firebase.google.com/docs/storage/web/file-metadata

  • @loxplosion95
    @loxplosion95 2 роки тому +1

    could you do a video just like this but not for react. just for plain javascript and firebase?

    • @FullstackSimplified
      @FullstackSimplified  2 роки тому

      Sure will do that!! Stay tuned

    • @loxplosion95
      @loxplosion95 2 роки тому

      @@FullstackSimplified but please make it work. I see UA-camrs on here that do fire base tutorials and it’s 20222 but for the tutorial they are using fire base 2018

    • @loxplosion95
      @loxplosion95 2 роки тому

      @@FullstackSimplified thanks!

  • @danielguerrero8460
    @danielguerrero8460 3 роки тому +1

    Wow, finally, thank you very much. I have seen several videos and could not find the solution. How can we download the image with the V9?

  • @engineermaxwel6732
    @engineermaxwel6732 3 роки тому +1

    Hello Bro , Could you do a video on how to send the downloadURL to the real-time database?

  • @Mysterio9999
    @Mysterio9999 2 роки тому

    How can we fetch this image and use it along with some textual data from the database , like i want to create a card with title , image and description, so the image come from the storage but how can I use title and description which comes for the firebase store and use all this with map function to map all the cards and display them

    • @FullstackSimplified
      @FullstackSimplified  2 роки тому

      Hi. You can store the image download url in the database along with other data you have and then you can simply use the url from the response in img src

  • @hamzapaskingakhtar
    @hamzapaskingakhtar 2 роки тому +1

    Hey man great video. I need help. I'm going to use firebase storage to upload files. But I also want to store that url into mongodb, instead of just console.log(url). How can I do that? Sorry I'm a beginner

    • @FullstackSimplified
      @FullstackSimplified  2 роки тому

      Once you get the download Url for the uploaded file you can make a request to your backend with the URL as a payload and then in your backend you can store the same in the MongoDb.
      Note- Connecting your MongoDB directly to your frontend can be a security issues as you will expose your db api keys and credentials to the public

    • @hamzapaskingakhtar
      @hamzapaskingakhtar 2 роки тому

      @@FullstackSimplified Thanks for the reply. Another Question bro. What if I want to upload multiple files. Like Select 1 file then upload like we did here. Staying on the same page. Select another file and upload. Select 3rd file then upload. If that makes sense

  • @scripter9607
    @scripter9607 2 роки тому +1

    This works, however the end is cut short and retreiving the url doesnt work, ive tried it with a global variable and still doesnt work

    • @FullstackSimplified
      @FullstackSimplified  2 роки тому +1

      Hi. You can take a look at the complete code of the project. Links will be in the description.

    • @scripter9607
      @scripter9607 2 роки тому

      @@FullstackSimplified I checked it out however, I still cant get to find the way to retreive the url variable outside of the function. I want to be able to add the url to a document in the firestore so I can download it into the UI latter

  • @somunelavalli
    @somunelavalli 3 роки тому +1

    Hi i am getting error like this Permission denied. Please enable Firebase Storage for your bucket by visiting the Storage tab in the Firebase Console and ensure that you have sufficient permission to properly provision resources.

    • @FullstackSimplified
      @FullstackSimplified  3 роки тому

      Have you set up storage in your firebase project and set the security rules ? Please follow the video from 04:10

  • @tashinamgay7922
    @tashinamgay7922 2 роки тому +1

    Thank you so much for the video.
    Can someone tell me how to upload an image and an audio together through a single form along with a the name of the song (user specified). Something like an online music player. I've been stuck here for days pls helpp.

    • @FullstackSimplified
      @FullstackSimplified  2 роки тому +1

      You have to upload them separately. Then you can store the download URL for both the files in Firestore or realtime database. Something like
      {
      name : "Song name",
      albumArt : ,
      audio :
      }

    • @tashinamgay7922
      @tashinamgay7922 2 роки тому

      @@FullstackSimplified thank youuu. I did just that and it worked but I've to create some sort of a pause between uploading the file and adding the doc to firestorm.
      Currently my adddoc and uploading runs simultaneously so an empty string gets uploaded to firestore since uploading takes some time

    • @FullstackSimplified
      @FullstackSimplified  2 роки тому +1

      You need to add the doc after you receive the download url in that callback

  • @anjanhr1614
    @anjanhr1614 Рік тому +1

    Thank you sooooooooooooooooooooooooooooo Much.

  • @anonymouspersonal9136
    @anonymouspersonal9136 2 роки тому

    How about if we want to have a button that downloads the file that we uploaded directly to our machine

  • @CodewithVoran
    @CodewithVoran 3 роки тому +1

    Thanks buddy

  • @yennhinguyen1992
    @yennhinguyen1992 2 роки тому

    hi, i follow your instruction and got this error: "Uncaught ReferenceError: ref is not defined" at the line
    const storageRef = ref(storage, `/images/${image.name}`);
    what is wrong?

  • @dreamArmy34
    @dreamArmy34 Рік тому +1

    hey I want to store two images so how can i achieve that please guide me

    • @FullstackSimplified
      @FullstackSimplified  Рік тому

      You can select 2 images from the file picker by making it accept multiple images. Then you can loop over the selected images and call the upload function for all the selected images.
      Or if you want to select one photo at a time then you can open the file picker twice and upload the selected photos one by one using the same upload function

    • @dreamArmy34
      @dreamArmy34 Рік тому

      @@FullstackSimplified Actually I was planning to create separate file picker for both images like profileImage and CoverImage. So will I have to create separate handleImageChange Functions ? Or it can be done in one function itself?

    • @FullstackSimplified
      @FullstackSimplified  Рік тому

      You can use the same function for both. Only thing you need to take care is defining different firebase path/location while uploading the photo

    • @dreamArmy34
      @dreamArmy34 Рік тому +1

      @@FullstackSimplified Thanks!

  • @filipeleonelbatista
    @filipeleonelbatista 2 роки тому +1

    This video help me againd 2x

  • @aryangupta839
    @aryangupta839 2 роки тому +1

    The file is not opening when I download it from the link or directly from firebase storage.
    How do I fix this issue ?

    • @FullstackSimplified
      @FullstackSimplified  2 роки тому +1

      It should open, can you share which type of files are you uploading

    • @aryangupta839
      @aryangupta839 2 роки тому

      I tried uploading pdf and jpg.
      Also after uploading it shows the file size as 9B for every file I upload

    • @FullstackSimplified
      @FullstackSimplified  2 роки тому

      Can you share the code of your upload logic ?

    • @aryangupta839
      @aryangupta839 2 роки тому

      @@FullstackSimplified if (!filestemp) return;
      const file=filestemp[0];
      console.log(file);
      const filename = file.name;
      const metadata = {
      contentType: `${file.contentType}`
      };
      const sotrageRef = ref(storage, `files/${filename}`);

      const uploadTask = uploadBytesResumable(sotrageRef,file,metadata);
      uploadTask.on(
      "state_changed",
      (snapshot) => {
      const prog = Math.round(
      (snapshot.bytesTransferred / snapshot.totalBytes) * 100
      );
      setProgress(prog);
      },
      (error) => console.log(error),
      () => {
      getDownloadURL(uploadTask.snapshot.ref).then((downloadURL) => {
      console.log("File available at", downloadURL);
      });
      }
      );

    • @aryangupta839
      @aryangupta839 2 роки тому

      Filestemp contains array of file
      I am testing it for just a single file first and that single file is taken in const named file

  • @george.ferreira
    @george.ferreira 3 роки тому

    Great video. But do you know how to call the method to delete a file in this version 9?

    • @FullstackSimplified
      @FullstackSimplified  3 роки тому +1

      github.com/firebase/snippets-web/blob/1c4c6834f310bf53a98b3fa3c2e2191396cacd69/snippets/storage-next/delete-files/storage_delete_file.js#L8-L20

    • @george.ferreira
      @george.ferreira 3 роки тому

      @@FullstackSimplified Excellent. Thanks.

  • @c-far7050
    @c-far7050 2 роки тому

    How can i save a video in storage and call it in my react app . Where it will play like youtube. Where the files loads in chunks.

    • @FullstackSimplified
      @FullstackSimplified  2 роки тому +1

      Well you can do so by transcoding your video into smaller chunks and uploading it to firebase storage. Then you can store the chunk detials in firestore and download chunks as the video progress.
      But this would be really expensive so i would suggest to use some 3rd party solutions like Vimeo or ziggeo. You can also use webrtc of you have your own backend

    • @c-far7050
      @c-far7050 2 роки тому

      @@FullstackSimplified thanks

  • @allans1212
    @allans1212 2 роки тому

    Hello i have an issue the file is uploaded to my firebase store but appear 9b size and i cant open it.. can you help me?

  • @crazyiron9003
    @crazyiron9003 2 роки тому

    Can you do multiple image upload ? And it will be saved in an array.

    • @FullstackSimplified
      @FullstackSimplified  2 роки тому

      You can use Promise.all to upload multiple images after selecting them

    • @crazyiron9003
      @crazyiron9003 2 роки тому

      @@FullstackSimplified can you please do a video for it ? It will be really helpful for us beginners. Thank you

  • @uzzal74
    @uzzal74 Рік тому +1

    THANKS IT HELPED ME sUSCCRIBED

  • @Human_Evolution-
    @Human_Evolution- 2 роки тому

    Well, where is the picture!? We must know how to display the image.

  • @aftereffectstraining7668
    @aftereffectstraining7668 Рік тому +1

    good explantion

  • @praisegodudeh6913
    @praisegodudeh6913 3 роки тому

    How to import more than one picture? More than one input?

    • @FullstackSimplified
      @FullstackSimplified  3 роки тому

      Well in firebase you can only upload 1 file at a time. If you want to upload multiple files you will have to loop over your files one by one and upload them using the loop. You can also use Promise.all to resolve the all the promises and then get an array of response

  • @mohamedyoussef8835
    @mohamedyoussef8835 2 роки тому +1

    Awesome video +++++++++++++++++++++++ Thank you

  • @akshaikumar7966
    @akshaikumar7966 3 роки тому

    multiple files are not getting uploaded, can you tell the solution for this, please

    • @FullstackSimplified
      @FullstackSimplified  3 роки тому

      Firebase doesn't allow to upload multiple files. You will have to use loop to upload one by one.

  • @keremesen2078
    @keremesen2078 3 роки тому +2

    thanks sir
    31.comment

  • @zhanezar
    @zhanezar 2 роки тому

    how do i delete a folder in storage?

    • @FullstackSimplified
      @FullstackSimplified  2 роки тому

      Hi. You can create a ref to the folder you want to delete. Then you can use deleteObject(your_ref) to delete

  • @eduardosalles9212
    @eduardosalles9212 2 роки тому +1

    thanks!!!

  • @thachnguyen5957
    @thachnguyen5957 3 роки тому +1

    thanks

  • @kllokoq
    @kllokoq 2 роки тому

    What happens if two files have the same name? Why isn't that really important thing addressed here? One way is to use uid of a currently authenticated user which we can get from auth.currentUser.uid. If your app has multiple files to upload such as cover letter, resume etc they should probably point to different folders. If the user reuploads any of them it will rewrite the previous file in the storage and not fill your storage with duplicates.

    • @FullstackSimplified
      @FullstackSimplified  2 роки тому

      Authentication was not covered in this video. It was more about the basics of file uploading. For the file name you can use any thing which suits your application architecture to avoid duplicates or file over riding

  • @robx_001
    @robx_001 2 роки тому +1

    you got a like

  • @michaeldriscoll6047
    @michaeldriscoll6047 2 роки тому

    thank you :')

  • @gonzalolarrica3901
    @gonzalolarrica3901 2 роки тому +1

    i love you

  • @asharma741
    @asharma741 2 роки тому +1

    Simple tutorials are best tutorials.
    Keep it up! @wesome

  • @qwyzex5210
    @qwyzex5210 2 роки тому +1

    cool.

  • @subhashnayak8895
    @subhashnayak8895 3 роки тому

    how to download the file??

    • @FullstackSimplified
      @FullstackSimplified  3 роки тому

      Using the download URL which we get from firebase after successful uploading of file

    • @subhashnayak8895
      @subhashnayak8895 3 роки тому

      @@FullstackSimplified thanks bro how to create sessions for users After signing in ??

    • @subhashnayak8895
      @subhashnayak8895 3 роки тому

      Using firebase authentication

    • @FullstackSimplified
      @FullstackSimplified  3 роки тому +1

      Firebase already does that for you. If you still want to override you can refer here firebase.google.com/docs/auth/admin/manage-sessions

    • @subhashnayak8895
      @subhashnayak8895 3 роки тому +1

      @@FullstackSimplified thank you bro u saved me

  • @simply_just_better
    @simply_just_better 2 роки тому +1

    My screen is now black

    • @FullstackSimplified
      @FullstackSimplified  2 роки тому

      Hey there thanks for watching! Can you please share more info about the error!!

  • @pagevpetty
    @pagevpetty 3 роки тому +1

    Uncaught (in promise) ReferenceError: useState is not defined

    • @FullstackSimplified
      @FullstackSimplified  3 роки тому

      Have you imported useState from the react package? Please check