Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • A AndroidAsync
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 333
    • Issues 333
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 19
    • Merge requests 19
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Koushik Dutta
  • AndroidAsync
  • Issues
  • #410
Closed
Open
Issue created Nov 12, 2015 by Administrator@rootContributor

"Need to do multipart/form-data uploads?"

Created by: JulienLeal

The example of "Need to do multipart/form-data uploads? That works too." Doesn't work !!!

AsyncHttpPost post = new AsyncHttpPost("http://myservercom/postform.html");
MultipartFormDataBody body = new MultipartFormDataBody();
body.addFilePart("my-file", new File("/path/to/file.txt"));
body.addStringPart("foo", "bar");
post.setBody(body);
AsyncHttpClient.getDefaultInstance().execute(post, new StringCallback() {
    @Override
    public void onCompleted(Exception ex, AsyncHttpResponse source, String result) {
        if (ex != null) {
            ex.printStackTrace();
            return;
        }
        System.out.println("Server says: " + result);
    }
});

This have an error with "new StringCallback", because "argument mismatch; cannot be converted to HttpConnectCallback)". I don't know how I fix this. I search for that issue but I don't find :(.

Follow the complete error "Error:(50, 49) error: no suitable method found for execute(AsyncHttpPost,) method AsyncHttpClient.execute(AsyncHttpRequest,HttpConnectCallback) is not applicable (argument mismatch; cannot be converted to HttpConnectCallback) method AsyncHttpClient.execute(String,HttpConnectCallback) is not applicable (argument mismatch; AsyncHttpPost cannot be converted to String) method AsyncHttpClient.execute(AsyncHttpRequest,AsyncParser,RequestCallback) is not applicable (cannot infer type-variable(s) T (actual and formal argument lists differ in length)) where T is a type-variable: T extends Object declared in method execute(AsyncHttpRequest,AsyncParser,RequestCallback)"

Assignee
Assign to
Time tracking