Welcome.php から:
function index()
{
if(!empty($_FILES)){
require('system/libraries/cloudfiles.php');
$upload_dir = 'upload/doc/2';
$tmp_name = $_FILES['upload']['tmp_name'];
$name = $_FILES['upload']['name'];
move_uploaded_file($tmp_name,"$upload_dir/$name");
$username = 'ABC';
$key = 'X';
$auth = new CF_Authentication($username, $key);
$auth->authenticate();
$conn = new CF_Connection($auth);
$container = $conn->get_container('documents');
$localfile = "$upload_dir/$name";
$object = $container->create_object($name);
$object->load_from_filename($localfile);
}
$this->load->view('global_header');
$this->load->view('welcome_message');
}
welcome_message.php から:
<form method="post" action="#" enctype="multipart/form-data"s>
<input type="file" name="upload"><br/>
<input type="submit">
</form>
私が遭遇した問題:
cacert.pem ~ このファイルは Web ディレクトリに配置する必要があり、API に付属しています。
pecl からの fileinfo が必要な場合があり、そのために libmagic が必要になる場合があります (まだ持っていない場合)。
パッケージ php5-curl も必要で、php は curl エラーを報告しないため、API を掘り下げて、機能しない場合は出力を追加します。