Here's my code... When this runs, test.png is created, but it has a small file size and is corrupt.
Any help would be appreciated. public function saveImageToServer(event:Event):void { var bmp:BitmapData = getBitmapData(); var pngEncode:PNGEncoder = new PNGEncoder(); var saveRequest:URLRequest = new URLRequest(); var loader:URLLoader = new URLLoader(); var byteArray:ByteArray = new ByteArray(); var variables:URLVariables = new URLVariables(); loader.dataFormat = URLLoaderDataFormat.VARIABLES; saveRequest.url = sm.uploadImageHelperFileAddress; byteArray = pngEncode.encode(bmp); saveRequest.method = URLRequestMethod.POST; variables.byteArray = byteArray; variables.directory = um.userName; variables.savePath = sm.savedImageDirectoryAddress; saveRequest.data = variables; loader.addEventListener(Event.COMPLETE, handleSaveSuccess); loader.addEventListener(IOErrorEvent.IO_ERROR, handleSaveError); loader.load(saveRequest); } <?php $png = $_POST['byteArray']; file_put_contents($filename, $png); echo "success"; ?>