我正在使用PHP,并且我有一个相对于我的PHP文件位于image/tomato.png的图像。
我已经成功地获得了一个云文件容器的列表,因此我知道我的rackspace身份验证正在按预期工作。
问:如何使用'phpx'?将图像文件上传到rackspace cloudfiles容器
发布于 2012-01-05 11:53:47
在github -> https://github.com/rackspace/php-cloudfiles上有一个用于PHP的简单的cloudfiles API绑定
样本使用情况:
<?php
// include the API
require('cloudfiles.php');
// cloud info
$username = ""; // username
$key = ""; // api key
// Connect to Rackspace
$auth = new CF_Authentication($username, $key);
$auth->authenticate();
$conn = new CF_Connection($auth);
// Get the container we want to use
$container = $conn->get_container('container name');
// store file information
$localfile = <filepath>;
$filename = <filename>;
// upload file to Rackspace
$object = $container->create_object($filename);
$object->load_from_filename($localfile);
?>https://stackoverflow.com/questions/8741969
复制相似问题