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
www.omar-fouad.net
Cellular: (+20) 1011.88.534
Mail: m...@omar-fouad.net

This e-mail and any attachment is for authorised use by the intended
recipient(s) only. It may contain proprietary material, confidential
information and/or be subject to legal privilege. It should not be copied,
disclosed to, retained or used by, any other party. If you are not an
intended recipient then please promptly delete this e-mail and any
attachment and all copies and inform the sender. Thank you.
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to