[英]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'); $ 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 https://github.com/towynlin/php-cloudfiles/commit/02a8c658db7e9969b35bb57c47ede232521a6617
and 和
https://github.com/towynlin/php-cloudfiles/commit/78c5d612fb5a7037e92f61acfaf10b59e09239e8 https://github.com/towynlin/php-cloudfiles/commit/78c5d612fb5a7037e92f61acfaf10b59e09239e8
bug report is here https://github.com/rackspace/php-cloudfiles/pull/23 错误报告在这里https://github.com/rackspace/php-cloudfiles/pull/23
Its just a few lines, I just patched it myself. 它只有几行,我自己打了补丁。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.