Skip to content

multer support for amala #47

Description

@redsomber
const storage = multer.diskStorage({
  destination: function (req, file, cb) {
    cb(null, './uploads/')
  },
  filename: function (req, file, cb) {
    cb(null, `${file.fieldname}-${Date.now()}-${file.originalname}`)
  },
})
const upload = multer({ storage: storage })

@Controller('/')
class UploadController {
  @Flow([upload.single('image')])
  @Post('/upload')
  upload(@File() files: Record<string, File>) {
    console.log(files)
  }
}

this is my code that doesn't give any errors at all. I get the file in logs, but I can't upload it.

Without using amala with only koa, everything works fine. I assume that the problem is a different way of processing the request, since it is impossible to access the fields through amala

originalname
fieldname and etc...

Therefore, multer receives incorrect data, I cannot solve the problem in any way.

is there a way to make friends with amala and multer?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions