我正在尝试将文件从远程文件加载到我的云文件容器中。
下面是云文件支持人员给我的示例代码:
<?php
require('cloud/cloudfiles.php');
$res = fopen("http://images.piccsy.com/cache/images/66653-d71e1b-320-469.jpg", "rb");
$temp = tmpfile();
$size = 0.0;
while (!feof($res))
{
$bytes = fread($res, 1024);
fwrite($temp, $bytes);
$size += (float) strlen($bytes);
}
fclose($res);
fseek($temp, 0);
//
$auth = new CF_Authentication('user','token ');
//Calling the Authenticate method returns a valid storage token and allows you to connect to the CloudFiles Platform.
$auth->authenticate();
$conn = new CF_Connection($auth);
$container = $conn->create_container("example");
$object = $container->create_object("example.jpg");
$object->content_type = "image/jpeg";
$object->write($temp, $size);
fclose($temp);
?>
我遇到的问题是以下错误:
Fatal error: Call to a member function create_container() on a non-object in /home2/sharingi/public_html/daily_dose/remote_test.php on line 24
不确定我在这里没有注意到什么。