lukeautry / tsoa

Build OpenAPI-compliant REST APIs using TypeScript and Node
MIT License
3.45k stars 494 forks source link

Upload multiple files with different field names #1493

Closed samuelexferri closed 7 months ago

samuelexferri commented 11 months ago

Sorting

Expected Behavior

I want to upload multiple files with different field names but this is not possible. I can only upload multiple files with the same field name.

Current Behavior


    @Patch("/uploadFile")
    @Security("jwt", ["user"])
    @Middlewares(checkMiddleware.checkUserIsEnabled)
    @SuccessResponse("200", "Files uploaded successfully")
    public async uploadFile(
        @UploadedFile("file1") profileImage: Express.Multer.File,
        @UploadedFile("file2") profileImage1: Express.Multer.File,
        @Request() expressRequest: express.Request
    ): Promise<Obj> {
        this.setStatus(HttpStatusCode.OK);
        const req = expressRequest as RequestCustomUser;
        const obj = await FileService.uploadFile(
            req.token,
            file1,
            file2,
        );
        return obj;
    }

Possible Solution

Steps to Reproduce

Context (Environment)

Version of the library: 5.1.1 Version of NodeJS: 20

Detailed Description

Breaking change?

samuelexferri commented 11 months ago

Similar to https://github.com/lukeautry/tsoa/issues/1295

github-actions[bot] commented 10 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

samuelexferri commented 10 months ago

Up

github-actions[bot] commented 9 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

samuelexferri commented 9 months ago

Up