0

今天在处理问题,我用dio上传文件,代码如下:

 ///upload the file 
  static Future upFile(String path, UptokenEntity value) async {
    FormData formData = FormData.fromMap({
      "key": value.key,
      "filename": value.filename,
      "token": value.token,
      "file": await MultipartFile.fromFile("$path", filename: value.filename),
    });
    var response;
    response = await uphttp.post("", data: formData);

    /*var t=await formData;
    bool testFlag=false;
    if(formData.length==t.length){
      testFlag=true;


    }
    print("上传测试的值为:$testFlag");*/
    return response.data;
  }

我遇到了例外Content size exceeds specified contentLength。这是我调试的图片: 在此处输入图片描述

4

0 回答 0