The correct way will be to use multipart POST method. See here for example code for the client.
For PHP there are many tutorials available. This is the first I've found. I recommend that you test the PHP code first using an html client and then try the java client.