I have an ActionScript 3 application that's sending an object to PHP via ZendAMF. The object contains a byteArray from an image.
I have it currently saving the byteArray into a Blob like so:
$ba = new Zend_Amf_Value_ByteArray ( $im->bArray );
$data = mysql_real_escape_string ( $ba->getData () );
$query = "INSERT INTO image ( byteArray ) VALUES ( '".$data."' );";
$result = mysql_query($query);
$error = mysql_error();
if($error)
return "Error: " . $error;
else
return true;
This seems to be working fine and I can see the image in the DB (this is running local and I'm using SequelPRO to view the DB).
The problem is when I'm sending the byteArray back to Flash, Flash reports the byteArray length as 0.
Here is my return method in PHP:
$result = mysql_query ( 'SELECT * FROM image');
$array = array();
while ( $row = mysql_fetch_assoc ( $result ) )
{
$ba = new Zend_Amf_Value_ByteArray ( $row['byteArray'] );
$image = new Image ();
$image->id = $row['id'];
$image->file = $row['filePath'];
$image->bArray = $ba->getData();
array_push ( $array, $image );
}
return ( $array );
Is there a better way to do this? Any help would be greatly appreciated.
Thank you