# Check if php is Done?

**URL:** <https://forum.kirupa.com/t/check-if-php-is-done/300028>\
**Category:** flash\
**Created:** [November 14, 2009, 5:42pm UTC](https://forum.kirupa.com/t/check-if-php-is-done/300028 "2009-11-14T17:42:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jebego](https://avatars.discourse-cdn.com/v4/letter/j/e480ec/32.png) [@jebego](https://forum.kirupa.com/u/jebego)\
**Post date:** [November 14, 2009, 5:42pm UTC](https://forum.kirupa.com/t/check-if-php-is-done/300028/1 "2009-11-14T17:42:49Z")

</div>

This may go under the php section, but I put it here because it may have more to do with AS.

I currently have a flash file and a php file. The flash file sends a byte array to the php file and the php file creates a .jpeg from it.

I’m now looking for a way for the php file to tell the flash file that it’s done creating the .jpeg so the flash file can do something else.

Here’s my AS3 code:

```php

var jpgSource:BitmapData = new BitmapData (canvas.width, canvas.height);
jpgSource.draw(canvas);
    
var jpgEncoder:JPGEncoder = new JPGEncoder(85);
var jpgStream:ByteArray = jpgEncoder.encode(jpgSource);
    
var request:URLRequest = new URLRequest ( "saveImage.php" );
var loader: URLLoader = new URLLoader();
request.contentType = "application/octet-stream";
request.method = URLRequestMethod.POST;
request.data = jpgStream;
loader.load( request );

```

And here’s my php code:

```php

<?php

$fp = fopen('image.jpeg', 'wb');
fwrite($fp, $GLOBALS['HTTP_RAW_POST_DATA']);
fclose($fp);

?>

```

Now I’m looking for a way for the php file to send some data to the flash file telling it it’s done writing the .jpeg. A listener maybe?

Thanks!
