1

I am using Ion library to upload image to web server.But when ever i try to set the parameters using setMultipartParamter i am getting null values.Why this is happening.

Code

 Ion.with(getActivity()).load("http://.......").setMultipartParameter("IUser_ID", "126").setMultipartParameter("&User_ID", "amody@gmail.com").setMultipartParameter("&FileTitle", strFileTitle).setMultipartParameter("&DT", strDocumentType).setMultipartFile("", new File(strFilePath)).asString().setCallback(new FutureCallback<String>() {
                        @Override
                        public void onCompleted(Exception e, String result) {
                            Log.e("Upload file response", "" + result);
                        }
                    });

I chaecked the server, the file is uploaded properly but the paramters are not.

user3844417
  • 139
  • 1
  • 4
  • 12

1 Answers1

1

You are passing in parameter names like they're query strings.

.setMultipartParameter("&User_ID", "amody@gmail.com")

You don't need the ampersand. Your server is likely looking at the wrong keys.

koush
  • 2,972
  • 28
  • 31
  • yes i tried without ampersand but still i am getting error – user3844417 Jul 30 '14 at 05:39
  • Error---07-30 11:07:03.959 31229-31229/example.com.pocketdocs E/Response﹕ System.NullReferenceException: Object reference not set to an instance of an object. at Web_Account_UploadFile.Page_Load(Object sender, EventArgs e) in C:\APP\PocketDocs\PocketDocs\PocketDocsWeb\web\Account\UploadFile.aspx.vb:line 19 – user3844417 Jul 30 '14 at 05:40
  • Looks like an error in your server code... I have unit tests to verify that multipart form uploads are working against App Engine and node.js servers. – koush Jul 30 '14 at 17:42