Saving a bytearray with php received from Flex Air app

ε祈祈猫儿з 提交于 2020-01-23 19:27:47

问题


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 with 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);

    }

}

回答1:


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;



来源:https://stackoverflow.com/questions/5554374/saving-a-bytearray-with-php-received-from-flex-air-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!