Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

request.files returning a empty array #29

Open
tibmartins opened this issue May 20, 2023 · 1 comment
Open

request.files returning a empty array #29

tibmartins opened this issue May 20, 2023 · 1 comment

Comments

@tibmartins
Copy link

tibmartins commented May 20, 2023

I tried list my files after upload and returns a empty array, works with diskStorage save buts not with cloudinary

app.post(
'/endpoint',
{preHandler: upload.array('files', 2)},
async (req, reply) => {
console.log(req.files) //empty
...cloudinary ...reply.send( ) })

@tibmartins tibmartins changed the title Request.file returning a empty array request.files returning a empty array May 20, 2023
@jailsonh3
Copy link

Following the post below I copy it into the file @types/fastify-multer.d.ts:
#16 (comment)

import 'fastify'
import { isMultipart } from '../../src/lib/content-parser'
import { File, FilesObject } from '../../src/interfaces'

type FilesInRequest = FilesObject | Partial<File>[]

declare module 'fastify' {
  interface FastifyRequest {
    isMultipart: typeof isMultipart
    file: File
    files: FilesInRequest
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants