问题
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