I am trying to utilize the PNGEncoder with the dynamicfash Base64 to send a Base64 String to PHP and save the PNG File but for some reason that i cannot figure out, the PNG file is never readable. It is there and has a size (contains data) but cannot be opened by anything so is not a valid png file. Here is my code...

Code:
	var target:MovieClip = new MovieClip();
	target.graphics.beginFill(0xff0000,5.0);
	target.graphics.drawRect(0,0,100,100);
	target.graphics.endFill();
	
	var bdata:BitmapData = new BitmapData(100, 100);            
	bdata.draw(target);  
	var stream:ByteArray = PNGEncoder.encode(bdata);             
	var byteArrayAsString:String = Base64.encodeByteArray(stream);

	var request:URLRequest = new URLRequest("pngsave.php");
	request.method = URLRequestMethod.POST;
	var variables:URLVariables = new URLVariables();
   	variables.fileName = "testing.png";
   	variables.image = byteArrayAsString;
   	request.data = variables;
	navigateToURL(request, "_blank");
and the Php...

Code:
<?php

header('Content-Type: image/png');
header("Content-Disposition: attachment; filename=".$_POST['fileName']);
   
echo base64_decode($_POST["image"]);
?>
Any ideas on what I am doing wrong here?