1

I try to upload a text file using MulitPartEntity but unable to upload .. my code is mention below please help me..

 File file = new File("/sdcard/" + strEmailAddress + ".txt");
    HttpClient httpclient = new DefaultHttpClient();

                HttpPost httppost = new HttpPost(strUrl);


        MultipartEntity reqEntity = new MultipartEntity(
                    HttpMultipartMode.BROWSER_COMPATIBLE);

            if (file.exists()) {
                Helper.printLogD(" file is exist ");
            }
            FormBodyPart bodyPart = new FormBodyPart("userfile",
                    (ContentBody) file);


        reqEntity.addPart(bodyPart);


        httppost.setEntity(reqEntity);

HttpResponse response = httpclient.execute(httppost);
kamal_tech_view
  • 4,235
  • 4
  • 28
  • 49

0 Answers0