我看到了其他问题,但这不是我想要的,我不想上传图像到服务器,我不想转换到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');
}
});
}