0
我有一个来自摄像头的图片作为位图。 这张照片我要发送的JPEG服务器通过HTTP POST,这样的事情:如何通过http post发送位图到服务器
Bitmap photo;
StringEntity reqEntity = new StringEntity(photo);
HttpClient httpclient = new DefaultHttpClient();
HttpResponse response = httpclient.execute(request);
我从蔚蓝
//Request headers.
request.setHeader("Content-Type", "application/json"); request.setHeader("Ocp-Apim-Subscription-Key", subscriptionKey);
// Request body.
StringEntity reqEntity = new StringEntity("{\"url\":\"upload.wikimedia.org/wikipedia/commons/c/c3/…\"}");
request.setEntity(reqEntity);
您的PIC转换为字符串base_64并发送 –
如何才能把它转换为base64? – tobias
https://stackoverflow.com/questions/7360403/base-64-encode-and-decode-example-code或https://stackoverflow.com/questions/9920967/android-post-base64-string-to-php –