php,如何将html文件上传到rackspace cloudfiles,易于理解的教程
我正在尝试使用 php 将原始文件(html 文件)上传到机架空间云文件,而不先将它们保存在磁盘上,但到目前为止我找不到一个简单的示例。例如,如何进行身份验证、连接等,以及如何将 example.html 上传到云文件。我已经找到了 API 文档,但我发现它们很难理解。 这是当前的代码
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 = $container->create_object($filename);^M $object->load_from_filename($localfile); ?>
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 = $container->create_object($filename);^M $object->load_from_filename($localfile); ?>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用内存文件:
You can use a memory file: