0

从这里获取图像。

Future getImage () async {

   File image = await ImagePicker.pickImage(source: ImageSource.camera);

   setState(() {
     imagePhoto = image;
   });

}

并通过这里。

Future upload (File image, File image2) async {
   FormData formData = new FormData.fromMap({
     "image": await MultipartFile.fromFile(image.path,filename: image.path.split("/").last),
     "signature": MultipartFile.fromFileSync(imagePhoto.path,filename: imagePhoto.path.split("/").last),
     "latitude": "${_currentPosition.latitude}, ${_currentPosition.longitude}",
   });
}

这个过程给了我错误 422。问题是图像来自相机,如果画廊意味着它通过成功。

4

0 回答 0