Haven't had a chance to look at the Zend remoting implementation yet.
Have you tried sending an object ?

var params:Object = {path:"images/", ba:ba};
NC.call("PHPClass.function", Res, params);

Not sure about the syntax to retrieve those in PHP, as I don't do PHP :)

// wild guess
function writeJpg($args) {
   $args["path"];
   $args["ba"];
}

regards,
Muzak

----- Original Message ----- From: "Omar Fouad" <[email protected]>
To: "Flash Coders List" <[email protected]>
Sent: Saturday, March 21, 2009 5:50 PM
Subject: [Flashcoders] Zend AMF Framework Paramaters error


Hello,

I've got some trouble with the Zend Framework (AMF) and ActionScript, in
sending multiple parameter to a PHP Function.
The user loads an image file from the local hard drive using FileReference
into the Flash Movie than I take the Image's Bitmap Data, encode it to with
JPGEncoder (CoreLib), get the byteArray of it and pass it to a PHP function
though a NetConnection Instance like this.

Main.as -

//ba is my byteArray from the encoder

var NC:NetConnection = new NetConnection();
var Res:Reponder = new Responder(onSuccess, onError);

NC.connect(zend_amf_server);
NC.call("PHPClass.function", Res, ba);
[...]

PHPClass.php -

function __construct() {...} //the construct code here

function writeJpg( $byteArray ) {
     $fp = fopen('data.jpg', 'wb');
       fwrite( $fp, implode("",$byteArray));
       fclose( $fp );
       return "File Saved";
}

This work like a charm, the file is created I get the response. I tried to
pass another argument to the function, a path string that holds the name of
the folder to be created like this.

Main.as -
var path:String = "images/"
NC.call("PHPClass.function", Res, ba, path);

PhpClass.php -

function writeJpg( $byteArray, $path ) {
     $fp = fopen($path.'data.jpg', 'wb');
       fwrite( $fp, implode("",$byteArray));
       fclose( $fp );
       return "File Saved";
}

Apparently this does not work. in the response I get this message:
"Error #2044: Unhandled NetStatusEvent:. level=error,
code=NetConnection.Call.BadVersion
   at fileUploader_fla::MainTimeline/onSave()" the image file is corrupted
and no folder is created.

Apparently the NC.call, cannot pass more than one parameter. I've been
searching about this problem on the web and I read that this is a bug in an
older version of zendAMF, I've downloaded the latest release, restarted by
MAMP server, but I still have the same problem...

How can this be achieved?

Thanks.

--
Omar M. Fouad - Adobe Flashâ„¢ Platform Developer

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to