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
I'm not sure why but according to provided screenshot of Swagger UI, your
file
field is inRequest body
section, but the rest of the fields are inParameters
section. As far as I know, all fields should be in one section calledRequest body
orParameters
.I suggest you try changing
Query()
toFormField()
accordingly to tsoa docs.If above does not help, I have a few suggestions:
swagger.json
with the one provided in the Swagger example.