# Save jpeg from Flash to server?

**URL:** https://forum.kirupa.com/t/save-jpeg-from-flash-to-server/329894
**Category:** programming
**Created:** [November 2, 2012, 6:00pm UTC](https://forum.kirupa.com/t/save-jpeg-from-flash-to-server/329894 "2012-11-02T18:00:24Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![e\_v](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/e_v/32/7787_2.png) [@e\_v](https://forum.kirupa.com/u/e_v)
#### Post date: [November 2, 2012, 6:00pm UTC](https://forum.kirupa.com/t/save-jpeg-from-flash-to-server/329894/1 "2012-11-02T18:00:24Z")

</div>

I am an AS3 developer, but I thought I might get more help posting my question here.

I have been successfully saving images from Flash through PHP to the server by posting a ByteArray to a simple PHP script that looks like this:

```php
$fileName = $_GET['filename'];
$fp = fopen( "images/user_images/" . $fileName, 'wb' );
fwrite( $fp, $GLOBALS['HTTP_RAW_POST_DATA'] );    
fclose( $fp );

```

The relavant AS3 looks like this:

```auto
var bytearray:ByteArray = jpgEncoder.encode(bitmapdata);
var urlRequest:URLRequest = new URLRequest("save_img.php?filename=" + filename);
urlRequest.contentType = "application/octet-stream";            
urlRequest.method = URLRequestMethod.POST;
urlRequest.data = bytearray;
urlLoader = new URLLoader();
urlLoader.load(urlRequest);

```

The project is being reviewed for security and the client “doesn’t like” the PHP file. I’ve been asked to find another way. Is there another way to save a jpeg from Flash to the server? Please?
