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

115
Views
Firebase Subiendo datos a la base de datos en tiempo real Todo no aparece

Estoy tratando de cargar archivos IMG desde mi computadora a mi base de datos en tiempo real de Firebase. Tengo la ubicación de la imagen almacenada dentro de una matriz json e incluye los otros detalles de los datos que quiero cargar. Me pregunto cómo puedo cargar el img a firebase. y obtenga la url de descarga. Actualmente tengo algo que funciona, el único problema es que las imágenes se cargan, pero solo 1 o 2 objetos aparecerán en la base de datos en tiempo real, además del número esperado de 9

 function makeCustomersHappy(){ var count = 0; fetch("./upcominTasks.json") .then(response => { return response.json(); }) .then(jsondata =>{ jsondata.forEach(position => { alert(count) count+=1; var imageName = JSON.stringify(position.name).replaceAll('"','')//neccesary for storing data var urlLink = JSON.stringify(position.url).replaceAll('"','') var itemName = JSON.stringify(position.name).replaceAll('"','') var store = JSON.stringify(position.store).replaceAll('"','') //get item name document.getElementById('sometext').textContent = imageName; document.getElementById('upIMG').src = `./dropImages/${imageName}.jpg` //change image //names the image for storage ref const storageRef = sRef(storage, `upcomingTasks/${imageName}.jpg`); var imgAddress = fetch(`http://127.0.0.1:5500/puppetBots/dropImages/${imageName}.jpg`) .then(function(response) { return response.blob() }).then(function(img_blob) { //location.reload() //uploads the image to firebase uploadBytes(storageRef,img_blob ).then((snapshot) => { //the image that we just uploaded we get the dowload url.... getDownloadURL(sRef(storage, `upcomingTasks/${imageName}.jpg`)) .then((img_url) => { writeUserData(count,itemName,urlLink,img_url,store) }); }); }); }); }); } async function writeUserData(id, name, url, imgLink,store) { const db = getDatabase(); //id is basically the loop we are currently at set(gRef(db, 'UpcomingDropLinks/' +id), { ImageUrl: imgLink, ItemName: name, ItemUrl : url, Store:store }); } makeCustomersHappy()
about 4 years ago · Juan Pablo Isaza
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!