MultipartEntityBuilder builder = MultipartEntityBuilder.create(); ContentType fileContentType = ContentType.create("image/jpeg"); String fileName = file.getName(); builder.addBinaryBody("images_file", file, fileContentType, fileName); HttpEntity entity = builder.build(); HttpPost request = new HttpPost(urlString+params); request.setEntity(entity); HttpClient client = HttpClients.createDefault(); HttpResponse response = client.execute(request); System.out.println(client. ); System.out.println(response.getStatusLine().getReasonPhrase()); Closed due to the fact that the question is too general by the participants Alexey Shimansky , D-side , aleksandr barakin , Streletz , VenZell 29 May '16 at 16:14 .
Please correct the question so that it describes the specific problem with sufficient detail to determine the appropriate answer. Do not ask a few questions at once. See “How to ask a good question?” For clarification. If the question can be reformulated according to the rules set out in the certificate , edit it .
|
1 answer
... ResponseHandler<String> handler = new BasicResponseHandler(); String body = handler.handleResponse(response); int code = response.getStatusLine().getStatusCode(); - Is this an answer or a piece of question? By the way, what is the question? - D-side
- This is the answer, and you can read the question in the title - JVic
- oneA strange question and answer .. without a description .. so you can re-copy the entire manual by the YAP)) - Alexey Shimansky
|