Don't know if this can help since it's out of context, but here's some code
I snipped out from my stuff:
Flex:
var myservice:HTTPService = new HTTPService();
var myBD:BitmapData = getBitmapData(areachart1);
var ba:ByteArray = myEncoder.encode(myBD);
var baEncoded:String = Base64.encodeByteArray(ba);
var params:Object = { imagedata:baEncoded };
myservice.addEventListener(ResultEvent.RESULT, resultHandler);
myservice.method = "POST";
myservice.url = "http://localhost/TracerBullets/php/tst_imagehandler.php";
myservice.useProxy = false;
myservice.send(params);
PHP:
// Implementation:
<?php
include("ImageHandler.php");
$myImageHandler = new ImageHandler();
if (isset($_POST["imagedata"])) {
$filename = $myImageHandler->writeTempFile($_POST["imagedata"]);
echo $filename;
} else {
echo "failure";
}
?>
<?php
class ImageHandler
{
function ImageHandler() {}
function writeTempFile( $base64EncodedFile )
{
$myImage = base64_decode($base64EncodedFile);
$uniqueFilename = $this->randomkeys(12);
$filename = $uniqueFilename;
if (!$handle = fopen($uniqueFilename, 'a')) {
$filename = 0;
}
if (fwrite($handle, $myImage) === FALSE) {
$filename = 0;
}
return $filename;
}
// Create unique filename
function randomkeys($length)
{
$pattern = "1234567890abcdefghijklmnopqrstuvwxyz";
$key = $pattern{rand(0,36)};
for($i=1;$i<$length;$i++) {
$key .= $pattern{rand(0,36)};
}
return "/tmp/".$key.".jpg";
}
}
?>
hth,
Mike
-------------------------------------------------------------
To unsubscribe from this list, simply email the list with unsubscribe in the
subject line
For more info, see http://www.affug.com
Archive @ http://www.mail-archive.com/discussion%40affug.com/
List hosted by http://www.fusionlink.com
-------------------------------------------------------------