ByteArray to MySQL from ActionScript 3 -> PHP via ZendAMF -


i have actionscript 3 application that's sending object php via zendamf. object contains bytearray image.

i have saving bytearray blob so:

$ba = new zend_amf_value_bytearray ( $im->barray ); $data = mysql_real_escape_string ( $ba->getdata () );  $query = "insert  image ( bytearray ) values ( '".$data."' );"; $result = mysql_query($query); $error = mysql_error();  if($error)  return "error: " . $error; else  return true; 

this seems working fine , can see image in db (this running local , i'm using sequelpro view db).

the problem when i'm sending bytearray flash, flash reports bytearray length 0.

here return method in php:

$result = mysql_query ( 'select * 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 better way this? appreciated.

thank you

just quick google of zend_amf_value_bytearray , seems there might problem zend in has problem not serializing byte array.

here few links zend forums talk issue:

  1. zend_amf not serialize zend_amf_value_bytearray instances
  2. bytearray not serialize zend_amf_value_bytearray. instead string given
  3. flex 4 / php data-centric photo transfers

good luck, , hope helps some.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -