我在这个函数中有一个问题,这个代码是在后台运行,上传相机拍摄的图像并转换成基46,我有一些错误。
请参见下图:
php - 使用http客户端android studio在base64中的uploadig图像-LMLPHP

 protected String doInBackground(Void... params) {

        ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
        nameValuePairs.add(new BasicNameValuePair("base64", ba1));
        nameValuePairs.add(new BasicNameValuePair("ImageName", System.currentTimeMillis() + ".jpg"));
        try {
            HttpClient httpclient = new DefaultHttpClient();
            HttpPost httppost = new HttpPost(URL);
            httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
            HttpResponse response = httpclient.execute(httppost);
            String st = EntityUtils.toString(response.getEntity());
            Log.v("log_tag", "In the try Loop" + st);

        } catch (Exception e) {
            Log.v("log_tag", "Error in http connection " + e.toString());
        }
        return "Success";

    }

请帮帮我
对不起语法

最佳答案

你可以把图书馆列入格雷德来解决这个问题。

useLibrary 'org.apache.http.legacy'

07-24 09:48
查看更多