1

私はcommons-httpclient-3.1jarファイルを使用してマルチパートファイルをtwitpicに投稿しています。iamgetingImagenot found例外は、私のコードHttpClient client = new HttpClient();です。client.getHttpConnectionManager()。getParams()。setConnectionTimeout(100000);

            PostMethod method = new PostMethod("http://twitpic.com/api/uploadAndPost");
            FilePart photo = new FilePart("photo", new ByteArrayPartSource("photo", b));


            photo.setContentType("image/jpeg");
            photo.setCharSet(null); 
            Part[] parts = { new StringPart("service", "Android mobile"),
                    new StringPart("username", "xxxxxx"),
                    new StringPart("password", "xxxxxx"),
                    new StringPart("message", "Test message"),

                     photo }; 



            try {
 method.setRequestEntity(new MultipartRequestEntity(parts, method.getParams())); 
 client.executeMethod(method);
 responseString = method.getResponseBodyAsString();

 method.releaseConnection();
} catch (HttpException e) {
 Log.v("e",e.toString());
 e.printStackTrace();
} catch (IOException e) {
 Log.v("e2",e.toString());
 e.printStackTrace();
} 

finally {
                method.releaseConnection();
        } 

 Log.v( "Response status: " , responseString);

何か提案がありますが、なぜこのエラーが発生し、なぜ画像を投稿できないのですか?ありがとうガネーシャ

4

0 に答える 0