How can I do a multipart Post in Dart / AngularDart

前端 未结 3 1997
小鲜肉
小鲜肉 2021-01-07 11:58

I\'ve got a REST api which assumes a multipartfile in the a post method.

Is there any way to do this kind of posts in Dart / AngularDart because all the solutions I\

3条回答
  •  醉酒成梦
    2021-01-07 12:03

    I finally found a way to post it as a multi-part form:

    void uploadFiles() {
        var formData = new FormData(querySelector("#fileForm"));
        HttpRequest.request("/sp/file", method: "POST", sendData: formData).then((req) {
            print("OK");
        });
    }
    

    is used in conjunction with

提交回复
热议问题