节约用PHP的ByteArray从Flex的AIR应用程序获得 [英] Saving a bytearray with php received from Flex Air app

查看:168
本文介绍了节约用PHP的ByteArray从Flex的AIR应用程序获得的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有远程服务AIR应用程序在codeigniter。 我想保存我从AIR应用程序获得的ByteArray 但是当我保存数据,我得到空文件与正确的文件名。

所以,一定是有什么毛病我ByteArray或我的方式保存数据。 有没有人有一个想法是什么,我做错了什么? 我已经调试我送的ArrayCollection和字节组肯定是有。

 公共职能uploadImage($图片)
{

    的foreach($形象为$ IMG)
    {

        $文件= $ IMG ['名称'];
        $数据=新的ByteArray($ IMG ['字节']);

        file_put_contents($ _ SERVER ['DOCUMENT_ROOT']'/上传/测试/'$文件,$数据);

    }

}
 

解决方案

确定为那些有兴趣谁在解决方案中,aparrently我不得不改变这种 $数据=新的ByteArray($ IMG ['字节']); 这个 $数据= $ IMG ['字节'] - >的数据;

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

    }

}

解决方案

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;

这篇关于节约用PHP的ByteArray从Flex的AIR应用程序获得的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆