简体   繁体   English

CloudFiles无法在虚拟目录之间复制

[英]CloudFiles cannot to copy between virtual directory

I try to copy a couple of files located on my container using the method 我尝试使用方法复制位于容器上的几个文件

CF_container->copy_object_to('th/image_a.jpg',Object(CF_container),'th/image_a_copy.jpg')

But when I try to copy a file that exists I got this message 但是,当我尝试复制存在的文件时,出现此消息

Specified object 'container_name/th/image_a.jpg' did not exist as source to copy from or 'container_name' did not exist as target to copy to.

What I doing wrong? 我做错了什么? This operation is impossible to do? 这个操作是不可能做到的? This operation cannot allowed? 不能进行此操作吗?

Thanks for your answer. 感谢您的回答。

It looks like you're using the SDK from php-cloudfiles. 看来您正在使用php-cloudfiles中的SDK。 The copy_object_to function can be found on github here . copy_object_to函数可以在github上找到

That library has been deprecated in favor of php-opencloud . 该库已不推荐使用php-opencloud The documentation can be found here 该文档可以在这里找到

The new function to use when copying an object is DataObject::Copy and can be found here . 复制对象时使用的新函数是DataObject :: Copy,可以在此处找到。

The programming logic to make a copy of a Cloud Files object with the php-opencloud library would look something like the following: 使用php-opencloud库复制Cloud Files对象的编程逻辑如下所示:

// we must include this file
require_once "php-opencloud.php";

define('AUTHURL', RACKSPACE_US);

// create new Rackspace connection
$connection = new \OpenCloud\Rackspace(AUTHURL,
                array('username' => USERNAME, 'apiKey' => APIKEY));

// connect to ObjectStore
$object_store = $connection->ObjectStore();

// create a container named CONTAINER_NAME
$cont = $ostore->Container();
$cont->Create(array('name'=>CONTAINER_NAME));

// create an object in that container
$obj = $cont->DataObject();
$obj->Create(array('name' => 'test_obj', 'content_type' => 'text/plain'), __FILE__);

// copy it to another object
$target = $cont->DataObject();
$target->name = $obj->Name().'-COPY';
$obj->Copy($target);

If you are unable to upgrade to using the php-opencloud library, it looks like another user had a similar problem here and tracked it down to a double-encoded slash. 如果您无法升级到使用php-opencloud库,则似乎另一个用户在这里遇到了类似的问题并将其跟踪到一个双编码的斜杠。

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

相关问题 虚拟机和实例的区别 - Difference between Virtual machine and instance 通过API创建Rackspace Cloudfiles用户 - Create Rackspace Cloudfiles user via API Windows Azure-在Web角色的虚拟目录中包括WCF服务 - Windows Azure - Include a WCF service in a virtual directory of a web role 将大对象上传到Cloudfiles返回不同的md5 - uploading large object to Cloudfiles returns different md5 在云存储提供商之间复制文件 - Copy files between cloud storage providers 如何在蔚蓝云中两个不同虚拟网络上创建的两个虚拟机之间发送流量 - How can I send traffic between two Virtual Machines which are created on two different virtual networks in azure cloud jClouds Java应用程序可在Cloud服务之间复制,移动和删除文件 - jClouds Java app to copy, move, delete files between Cloud services 无法将文件从谷歌云存储桶复制到 VM 实例 - cannot Copy file from google cloud bucket to VM instance Google Cloud功能和在Google Cloud的虚拟机上运行的Web服务之间有什么区别? - What is difference between google cloud functions and web services running on virtual machine on google cloud? cp_ cannot stat: no such file or directory: Error copying files from localhost to k8s pod through Ansible - cp_ cannot stat: no such file or directory: Error copying files from localhost to k8s pod through Ansible
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM