Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

219
Vistas
Firebase Storage Overwriting Files

I have small bug in my program.

I have firebase Storage in my app. I wanna let the user to upload image to the storage.

the thing is when the user uploads image and then tries to upload another image. what the program does it overwrites the image was uploaded before.

what I want is to avoid "overwrite" when the user wants to upload another image. and keep both images in different file

let currentUser = Auth.auth().currentUser
    let StorageRefrenece = Storage.storage().reference()
    let posterImageRef =
        StorageRefrenece.child("posters").child(currentUser!.uid).child("posterOne.jpg")

Thnx

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

That is happening because you're storing them with the same name. In Firebase Storage you're the one in charge to decide the name of the files, there is no ".childByAutoId()".

If you want to have different files, you can create random values to name them, that is well explained here: How does one generate a random number in Apple's Swift language?

Your final code should look like this:

StorageRefrenece.child("posters").child(currentUser!.uid).child(<#Any Random Value#>)
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda