Uploading multipart file with Koush Ion library

前端 未结 2 490
抹茶落季
抹茶落季 2021-01-03 05:51

In my last app I\'m going to use Koush Ion library. It\'s so handy but i have a problem with uploading file to my rest server. note: My server response to success upload Pro

2条回答
  •  遥遥无期
    2021-01-03 06:16

    Searched pretty long for this and noticed that the important thing was to include POST in .load()

    Ion.with(getBaseContext()).load("POST",url).uploadProgressHandler(new ProgressCallback()
            {
                @Override
                public void onProgress(long uploaded, long total)
                {
                    System.out.println("uploaded " + (int)uploaded + " Total: "+total);
                }
            }).setMultipartParameter("platform", "android").setMultipartFile("image", new File(getPath(selectedImage))).asString().setCallback(new FutureCallback()
            {
                @Override
                public void onCompleted(Exception e, String result)
                {
    
                }
            });
    

提交回复
热议问题