1

我尝试使用 MulitPartEntity 上传文本文件但无法上传..我的代码在下面提到请帮助我..

 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);
4

0 回答 0