I try to use HTTP POST to send some Data to a Server. The Server expects the binary Data in $_POST['file'].
        URL url = new URL("http://example.com");
        URLConnection connection = url.openConnection();
        connection.setDoOutput(true);
        OutputStream outputStream =  connection.getOutputStream();
        outputStream.write("file=".getBytes());
                //byte[] buffer contains the data
            outputStream.write(buffer);         
        outputStream.close();
Is OutputStream.write the right method to write into the stream? Do I have to handle the string ("file=") other then the buffer?
 
     
     
     
    