我正在测试通过相机从flutter应用程序到我的express api的发送,但是当我这样做时,我总是得到一个空表,我做错了吗?
这是我的代码:
flutter应用程序:
final filename = '${DateTime.now()}.png';
final path = join((await getTemporaryDirectory()).path, filename);
await cameraController.takePicture(path);
FormData formData = new FormData.fromMap({
"file": MultipartFile.fromFile(path, filename: filename)
});
await dio.post('api_url', data: formData)
.then((value) => print)
.catchError((err) => print);
我的api:
async ocr(req, res): Promise<void> {
console.log(req.files);
return res.send('ok')
}