开发者

RackSpace Cloudfiles api error 'Undefined offset: 8'

When trying to upload files to rackspace cloudfiles, I am getting this error. I tried to trace the source of error and I assume that it is coming from this line of code:

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

This is the complete error that I am getting:

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

And this is the code for upload:

<?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";
?>


This problem has been fixed in their repo but it still exists in the download version.

The fixes can be found here

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

and

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

bug report is here https://github.com/rackspace/php-cloudfiles/pull/23

Its just a few lines, I just patched it myself.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜