protected String multipartPost(String url, Map<String, ?> params, String caller) throws IOException
    {
        // set up the POST
        logurl(url, caller);
        URLConnection connection = new URL(url).openConnection();
        String boundary = "----------NEXT PART----------";
        connection.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary);
        setCookies(connection);
        connection.setDoOutput(true);
        connection.connect();
        boundary = "--" + boundary + "\r\n";
        
        // write stuff to a local buffer
        ByteArrayOutputStream bout = new ByteArrayOutputStream();
        DataOutputStream out = new DataOutputStream(bout);
        out.writeBytes(boundary);
        
        // write params
        for (Map.Entry<String, ?> entry : params.entrySet())
        {
            String name = entry.getKey();
            Object value = entry.getValue();
            out.writeBytes("Content-Disposition: form-data; name=\"" + name + "\"\r\n");
            if (value instanceof String)
            {
                out.writeBytes("Content-Type: text/plain; charset=UTF-8\r\n\r\n");
                out.writeBytes((String)value);
            }
            else if (value instanceof byte[])
            {
                out.writeBytes("Content-Type: application/octet-stream\r\n\r\n");
                out.write((byte[])value);
            }
            else
                throw new UnsupportedOperationException("Unrecognized data type");
            out.writeBytes("\r\n");
            out.writeBytes(boundary);
        }
        out.writeBytes("--\r\n");
        out.close();
        // write the buffer to the URLConnection
        OutputStream uout = connection.getOutputStream();
        uout.write(bout.toByteArray());
        uout.close();

        // done, read the response
        BufferedReader in = new BufferedReader(new InputStreamReader(
            zipped ? new GZIPInputStream(connection.getInputStream()) : connection.getInputStream(), "UTF-8"));
        grabCookies(connection);
        String line;
        StringBuilder temp = new StringBuilder(100000);
        while ((line = in.readLine()) != null)
        {
            temp.append(line);
            temp.append("\n");
        }
        in.close();
        return temp.toString();
    }