How to copy a file between locations in a Rackspace Cloud Files container with their PHP API

扶醉桌前 提交于 2019-12-11 15:38:22

问题


Given the code

$this->cf_container->copy_object_to($file, $this->cf_container, $new_path . '/' . $file_subpath);

where $this->cf_container is an object of the CF_Container class, I get this error:

"Specified object 'A random container/one/pow/whiskey.jpg' did not exist as source to copy from or 'A random container' did not exist as target to copy to."

The container's name, obviously, is "A random container". I have tried this with a container that does not contain spaces to the same effect.

If I do a $this->cf_container->get_object($file) I get a CF_Object object with the file's properties, so it exists.

$file is equal to "one/pow/whiskey.jpg" $new_path is equal to "one/different_folder" $file_subpath is equal to "whiskey.jpg"

Anyone have a clue or has encountered this before?


回答1:


You might want to try the new Rackspace PHP SDK (aka php-opencloud). The php-cloudfiles will eventually be deprecated.

To copy an object in php-opencloud check out DataObject::Copy. If you run into problems, you can file issues here.



来源:https://stackoverflow.com/questions/14940942/how-to-copy-a-file-between-locations-in-a-rackspace-cloud-files-container-with-t

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