我试图确保在multer上传任何图像之前,不会有任何条件取消发布请求的可能性,因为如果发布成功,尽管事实发布请求被取消了,图像仍将被上传。 例子
//example
const router = require('@koa/router')()
const upload = require('@koa/multer')()
//some post request
router.post('/reg', upload.single('image'), async ctx => {
if(condition){
//so, if this condition passed, image must be uploaded
} else{
//If not, nothing should happend
}
})
如何执行此操作?