开发者

Saving a bytearray with php received from Flex Air app

开发者 https://www.devze.com 2023-02-22 00:31 出处:网络
I have an Air application with remote service in codeigniter. I\'m trying to save a bytearray that I received from the Air app

I have an Air application with remote service in codeigniter. I'm trying to save a bytearray that I received from the Air app but when I save the data I get empty files wi开发者_JAVA百科th the correct filename.

So there must be something wrong with my bytearray or the way I save the data. Does anyone have an idea what I'm doing wrong? I've debugged the Arraycollection I sent and the bytearray is definitely in there.

public function uploadImage($image)
{

    foreach($image as $img)
    {

        $file = $img['name'];
        $data = new ByteArray($img['bytes']);

        file_put_contents( $_SERVER['DOCUMENT_ROOT'] . '/uploads/test/' .$file, $data);

    }

}


Ok for those who are interested in the solution, aparrently I just had to change this $data = new ByteArray($img['bytes']); into this $data = $img['bytes’]->data;

0

精彩评论

暂无评论...
验证码 换一张
取 消