-- Not confirmed -- confirmed just 1 file parameter. public static void sendMultipart(HttpURLConnection connection, String[] filefield, File[] filepath, Map<String, String> textdata) throws IOException { final String twoHyphens = "--"; final String boundary = "*****"+ UUID.randomUUID().toString()+"*****"; final String lineEnd = "\r\n"; final int maxBufferSize = 1024*1024*3; DataOutputStream outputStream; connection.setDoInput(true); connection.setDoOutput(true); connection.setUseCaches(false); connection.setRequestMethod("POST"); // connection.setRequestProperty("Connection", "Keep-Alive"); connection.setRequestProperty("Content-Type", "multipart/form-data; boundary="+boundary); outputStream = new DataOutputStream(connection.getOutputStream()); if(filefield != null) {