RackSpace Cloudfiles api错误'Undefined offset:8'

时间:2011-06-21 13:33:19

标签: api rackspace cloudfiles

尝试将文件上传到rackspace云文件时,我收到此错误。 我试图追踪错误的来源,我认为它来自这行代码:

$ container = $ conn-> get_container('test');

这是我得到的完整错误:

Notice
Undefined offset: 8
File: /dm/cloudfiles/cloudfiles.php, Line: 1588

这是上传代码:

<?php
// include the Cloud API.
require('cloudfiles/cloudfiles.php');

// Rackspace Connection Details;
// cloud info
$username = "tariehk"; // username
$key = ""; // api key

// Connect to Rackspace
$auth = new CF_Authentication($username, $key);

$auth->authenticate();
$conn = new CF_Connection($auth);

//Set the Container you want to use
$container = $conn->get_container('dm');

//Temp store the file
$localfile = $_FILES['uploadfile']['tmp_name'];
$filename = $_FILES['uploadfile']['name'];

 //exit();
//Uploading to Rackspace Cloud
$object = $container->create_object($filename);
$object->load_from_filename($localfile);

echo "Your file has been uploaded";
?>

1 个答案:

答案 0 :(得分:0)

此问题已在其回购中修复,但在下载版本中仍然存在。

可以在此处找到修复程序

https://github.com/towynlin/php-cloudfiles/commit/02a8c658db7e9969b35bb57c47ede232521a6617

https://github.com/towynlin/php-cloudfiles/commit/78c5d612fb5a7037e92f61acfaf10b59e09239e8

错误报告在这里 https://github.com/rackspace/php-cloudfiles/pull/23

它只是几行,我只是自己打补丁。