when i only define what keys and values for post data & path to file for file upload
@codenoid, what do you mean? There are some examples in issues. See https://github.com/kittinunf/fuel/issues/479 and https://github.com/kittinunf/fuel/issues/529.
Additionally, check out upload in README.md, and the UploadRequestTests.
@CoolMind is there any example of HashMap<String, String>() var usage for form data with file upload ?
var client = AsyncHttpClient();
var params = RequestParams();
params.put("file", File("/storage/emulated/0/Telegram/Telegram Images/852237039_126976.jpg"));
params.put("id", "21")
client.setBasicAuth("username","password");
client.post(this, "http://5.5.5.68:2018/api/file-upload", params, object: JsonHttpResponseHandler(){
override fun onSuccess(statusCode: Int, headers: Array<Header>, response: JSONObject) {
super.onStart()
}
});
superb easy
@codenoid, :)
It is AsyncHttpClient, not Fuel. :) Of course, it works, but I am not sure it will work with coroutines or RxJava.
yes sir @CoolMind , from the example, it's easier to work with AsyncHttpClient
@codenoid, ah, understood. Probably it's easier, also you can try Retrofit. I was not right, AsyncHttpClient is compatible with RxJava.
For HashMap probably https://github.com/kittinunf/fuel/issues/56 will help.
Good luck!