ia trying upload multiple images server using android ion library
ion.with(progressbarupload.this) .load(url) .uploadprogressbar(progressbar) .uploadprogresshandler(new progresscallback() { @override public void onprogress(long downloaded, long total) { uploadcount.settext("" + downloaded + " / " + total); } }) .setmultipartfile("uploaded_file", f) .setmultipartparameter("name", "andrew") .asstring().setcallback(new futurecallback<string>() { @override public void oncompleted(exception e, string result) { toast.maketext(getbasecontext(), "" + result, toast.length_short).show(); } }); } });
here in request need add setmultipartfile("uploaded_file", f)
request dynamically per how many images user selects
to make file upload optional add multipart part, add file part dynamically
arraylist<part> filesparts = new arraylist<>(); fileparts.add(new filepart("uploaded_file",new file(path))); //dynamically add
then add .addmultipartparts(filesparts)
request