【发布时间】:2018-12-12 04:45:04
【问题描述】:
我看到了其他问题,但这不是我想要的,我不想将图像上传到服务器,我不想转换为 base64...
我只想以表单数据或其他方式发布文件并获取返回的信息。
我有这个,但没有工作:
void onTakePictureButtonPressed() {
takePicture().then((String filePath) {
if (mounted) {
setState(() {
imagePath = filePath;
videoController?.dispose();
videoController = null;
});
http.post('http://ip:8082/composer/predict', headers: {
"Content-type": "multipart/form-data",
}, body: {
"image": filePath,
}).then((response) {
print("Response status: ${response.statusCode}");
print("Response body: ${response.body}");
});
if (filePath != null) showInSnackBar('Picture saved to $filePath');
}
});
}
【问题讨论】:
标签: post dart flutter form-data