android http POST发送包括位图在内的两个参数

时间:2016-03-30 11:08:51

标签: android http post

我通过POST发送String

            connection = new URL(UrlAddress).openConnection();
            connection.setDoOutput(true); // Triggers POST.
            //urlConnection.setChunkedStreamingMode(0);

            String charset = "UTF-8";  
            String param1 = "test";

            String query = String.format("param1=%s",
                    URLEncoder.encode(param1, charset));
            OutputStream output = connection.getOutputStream();
            output.write(query.getBytes(charset));

            inputStream = connection.getInputStream();

我可以通过一个POST操作发送两个参数,例如String query = String.format("param1=%s&param2=%s", ...吗?我需要在文本类型参数之后将字节序列参数(位图图片)附加到POST,我该怎么写呢?

0 个答案:

没有答案