Skip to content
This repository has been archived by the owner on Dec 23, 2021. It is now read-only.

Rackspace cloudfiles

sjlu edited this page May 29, 2012 · 4 revisions

Usage

You should checkout application/libraries/cloudfiles.php for a list of available functions. You will also need to edit config/cloudfiles.php in order to properly use the Cloudfiles library module.

Available functions

create_container($cname)

$cname is the name of the container you want to create. If something goes wrong, it will return false as its output.

delete_container($cname)

$cname is the container name you want to delete. If the container does not exist, it'll return true stating that the container does not exist.

make_container_private($c)

$c is the container name. This will constrain the container from being accessible from the world wide web. If the container is private, no files will be able to be accessed with generated URLs.

create_object($c, $f)

$c is the container name you want to place the file into. $f is the file name path (such as tmp/filename.png) of the file you want upload. This will return false if the container does not exist or if it cannot upload or create the object.

delete_object ($c, $f)

$c is the container name, $f if the filename. This will delete the file and return true if the file does not exist.

get_object_url($c, $f, $ssl)

$c is the container name, $f is the filename. $ssl is a boolean that you can set if you want SSL secured links (this is optional and will default to true). This function will return a URL you can use to access the given filename from the world wide web. This will return false if no such file exists.

list_objects($c)

$c is the container name. This will give an array list of the files in the container. All of them.

Example

$this->load->library('cloudfiles');
$this->cloudfiles->create_container('containername');
$this->cloudfiles->create_object('containername', '/path/to/file');