Reputation: 478
I have a problem with Tsoa nodejs File upload
I wrote the method based on the tsoa documentation but the output varible is always undefined
This is my method
@Post('/uploadNewExporterTemplate')
public async uploadNewExporterTemplate(
@Query() templateName: string,
@Query() unit: string,
@Query() testWith: string,
@UploadedFile() file: Express.Multer.File,
) {
const mul = multer()
console.log(file,unit,testWith);
return {stat:"Ok",ss:templateName}
}
And this is the swagger result
and finally this the debug result
Upvotes: 0
Views: 1534
Reputation: 558
I'm not sure why but according to provided screenshot of Swagger UI, your file
field is in Request body
section, but the rest of the fields are in Parameters
section. As far as I know, all fields should be in one section called Request body
or Parameters
.
I suggest you try changing Query()
to FormField()
accordingly to tsoa docs.
If above does not help, I have a few suggestions:
swagger.json
with the one provided in the Swagger example.Upvotes: 1