简体   繁体   English

如何使用其PHP API在Rackspace Cloud Files容器中的位置之间复制文件

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

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: 其中$ this-> cf_container是CF_Container类的对象,出现此错误:

"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." “指定的对象'A random container / one / pow / whiskey.jpg'作为复制源不存在,或者'A random container'作为复制目标不存在。”

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. 如果我执行$ this-> cf_container-> get_object($ file),则会得到具有文件属性的CF_Object对象,因此该对象存在。

$file is equal to "one/pow/whiskey.jpg" $new_path is equal to "one/different_folder" $file_subpath is equal to "whiskey.jpg" $ file等于“ one / pow / whiskey.jpg” $ new_path等于“一个/ different_folder” $ file_subpath等于“ whiskey.jpg”

Anyone have a clue or has encountered this before? 任何人有线索或曾经遇到过这个?

You might want to try the new Rackspace PHP SDK (aka php-opencloud). 您可能想尝试新的Rackspace PHP SDK (又名php-opencloud)。 The php-cloudfiles will eventually be deprecated. php-cloudfiles最终将被弃用。

To copy an object in php-opencloud check out DataObject::Copy . 要在php-opencloud中复制对象,请签出DataObject :: Copy If you run into problems, you can file issues here . 如果遇到问题,可以在此处提交问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM