Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

143
Views
Get image from firebase storage

I'm building a blog where an authenticated user should be able to include an image in a post. I have read all documentation provided by firebase but the only solution I find is to provide the name of the image stored.

The problem is that I don't know what the name of the image will be so I'm looking for a solution where I could use e.target or something to pick the correct image.

Right now, I'm only able to fetch an image if I provide the name of the image in the storage.

const uploadImage = () => {
    if (image == null) return;
    const imageRef = ref(storage, `images/${image.name}`);
    uploadBytes(imageRef, image).then((snapshot) => {
      getDownloadURL(snapshot.ref).then((url) => {
        setImageUrls((prev) => [...prev, url]);
      });
    });
  }; 
  useEffect(() => {
    const fetch = async () => {
      const storage = getStorage();
      const img = ref(storage, `images/${image.name}`); // not working
      await getDownloadURL(img).then((x) => {
        setUrl(x);
      });
    };
    if (url === undefined) {
      fetch();
    }
  }, []);
about 4 years ago · Santiago Gelvez
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!