我有远程服务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应用程序获得
发布评论