-2

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);
?>

Michael
  • 6,377
  • 14
  • 59
  • 91
  • half a second of googling with `rackspace cloudfiles php api` brings up a ton of examples, including: http://www.thetutorialblog.com/php/uploading-files-to-rackspace-cloud-mosso-using-php-api/ – Marc B Jun 27 '11 at 12:17
  • @Marc I think most of them are outdated – Michael Jun 27 '11 at 12:18
  • @Marc Also my requirement is to upload the files without to save them on the local disk . I couldn't find any example on google either . – Michael Jun 27 '11 at 12:58

1 Answers1

0

You can use a memory file:

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