开发者

php, how can I upload a html file to rackspace cloudfiles , easy to understand tutorial

I'm trying to upload raw files (html files) to rackspace cloudfiles using php without to save them on the disk first but so far I couldn't find a simple example . E.g How to auth , connect etc and do everything to upload example.html to the cloudfiles. I already found the API documents but i find them difficult to understand . Here is the current code

authenticate();^M
$conn = new CF_Connection($auth);^M

// Get the container we want to use^M
$container = $conn->get_container('html');^M

// store file information^M
//$localfile = $_FILES['upload']['tmp_name'];^M
//$filename = $_FILES['upload']['name'];^M

 $localfile = file_get_contents("http://www.google.com/");

  $filename = "getip";
// upload file to Rackspace^M
$object = $contai开发者_C百科ner->create_object($filename);^M
$object->load_from_filename($localfile);
?>


You can use a memory file:

$fh = fopen('php://memory', 'bwr');
etc..
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜