Advertisement
Viruthagiri

Untitled

Aug 23rd, 2011
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. // include the Cloud API.
  3. require('cloudapi/cloudfiles.php');
  4.  
  5. // Rackspace Connection Details;
  6. $username = "myusername"; // put username here
  7. $key = "mykey"; // api key
  8.  
  9. // Connect to Rackspace
  10. $auth = new CF_Authentication($username, $key,NULL,UK_AUTHURL);
  11.  
  12. $auth->authenticate();
  13. $conn = new CF_Connection($auth);
  14.  
  15. //Set the Container you want to use
  16. $container = $conn->get_container('testing');
  17.  
  18. //Temp store the file
  19. $localfile = $_FILES['uploadfile']['tmp_name'];
  20. $filename = $_FILES['uploadfile']['name'];
  21.  
  22. //Uploading to Rackspace Cloud
  23. $object = $container->create_object($filename);
  24. $object->load_from_filename($localfile);
  25.  
  26. echo "Your file has been uploaded";
  27. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement