Guest User

Untitled

a guest
Jun 25th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.85 KB | None | 0 0
  1. class photo {
  2.  
  3.     public static $version = '1.0';
  4.     function photo() {
  5.         add_include_path($GLOBALS['SIGNAL']['LIBRARIES']['PATH'].'cloudfilesAPI/');
  6.         add_include_path($GLOBALS['SIGNAL']['LIBRARIES']['PATH'].'cloudfilesAPI/ZendFramework/library');
  7.         require_once 'Compass/Service/Rackspace/Cloudfiles.php';
  8.         $this->cf = new Compass_Service_Rackspace_Cloudfiles($GLOBALS['SIGNAL']['RACKSPACE_USER'],$GLOBALS['SIGNAL']['RACKSPACE_API_KEY']);
  9.         $this->cf->auth();
  10.     }
  11.  
  12.  
  13. // the actual upload i am calling this method 3 times on 3 files ( 50kb , 10 kb , 20 kb)
  14.     private function uploadToRackspaceCloudFiles ( $filePath ,$containerName , $fileUri)
  15.     {
  16.         //__p(array($filePath ,$containerName , $fileUri));
  17.         $contents = file_get_contents($filePath);
  18.         try {
  19.             $this->cf->putObject($containerName.'/'.$fileUri, $contents);
  20.         }
  21.         catch(Exception $e){
  22.            
  23.         }
  24.     }
Add Comment
Please, Sign In to add comment