未处理的异常:DioError [DioErrorType.RESPONSE]:Http状态错误[500]

时间:2020-05-16 22:34:08

标签: android ios flutter https

我正在尝试使用此代码将图像上传到服务器,并且在我对其进行调试时显示该错误 未处理的异常:DioError [DioErrorType.RESPONSE]:Http状态错误[500] 而且我不明白服务器中发生了什么或正在发生什么 我尝试使用http包,它显示了相同的错误

  Dio dio =new Dio();
      var formData = new FormData.fromMap({
        //"image": await MultipartFile.fromFile(imagePath, filename: imageName),
        "description": "fghfghfghfgh",
        "type": "Profile",
        "selected": "YES",
        "category_id": 3,
      });
    final file = await MultipartFile.fromFile(imagePath, filename: imageName);
    MapEntry<String, MultipartFile> _mapEntry = MapEntry('image', file);
    formData.files.add(_mapEntry);
      Response response = await dio.post("https://top-food.coders-artists.com/api/categories/images/create", data: formData);

0 个答案:

没有答案