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

247
Views
AdonisJS, ¿cómo puedo almacenar múltiples imágenes con foreach?

¡Acabo de empezar a aprender AdonisJS! Puedo almacenar una imagen, pero ahora quiero almacenar varias imágenes y no puedo encontrar ningún ejemplo en AdonisJS, ¿cómo puedo hacer eso?

Ahora estoy guardando una imagen como esta

 const imageSchema = schema.create({ image: schema.file.optional({ size: '2mb', extnames: ['jpg', 'png', 'gif'], }), }) const validatedData = await ctx.request.validate({ schema: imageSchema }) let tourDetailedImages: string | null = null const image = ctx.request.file('image') if (image) { const imageFileName = `tour-detailed-${validatedData.image?.size}.${image.extname}` await image.moveToDisk(`./`, { visibility: 'public', name: imageFileName, }) tourDetailedImages = await Drive.getUrl(imageFileName) } const newImage: Partial<Image> = { ...validatedData, image: tourDetailedImages ?? '', } const storedImages = await Image.create(newImage)

¿Cómo puedo almacenar 10 imágenes al mismo tiempo? Creo que necesito foreach aquí, pero realmente no sé cómo usarlo, ¿alguien puede ayudarme con esto?

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!