How to send bufferedImage from JAVA to PHP
<p>I am kinda noob with JAVA. Here's my problem :</p>

<p>I am trying to take a screenshot of my JAVA application and send it to a PHP page.
With the code i Have, The img file of the screenshot is created by the PHP but when you open it it's all black minus a small line of gibberish white/black;</p>

<p>Did i miss something or what did i do wrong?</p>

<p>JAVA code</p>

<pre><code>File f = File.createTempFile("support", ".png");
this.imageFileName = f.getAbsolutePath();
Robot r = new Robot();
this.snapshot = r.createScreenCapture(this.frame.getBounds());
BOSHTTPClient http;
http = newBOSHTTPClient(this.config.getHttpUrlName()+"?filename="+JBOSupportGlassPane.this.imageFileName);
ImageIO.write(this.snapshot, ImageFormat.PNG, http.getOutputStream());
</code></pre>

<p>PHP CODE</p>

<pre><code>$fileData=file_get_contents('php://input');
$filename = substr($_REQUEST['filename'], strrpos($_REQUEST['filename'], '/')+1);
$fhandle=fopen("screenshots/".$filename, 'wb');
fwrite($fhandle, $fileData);
fclose($fhandle);
echo("Done uploading");
</code></pre>
