Hi,
we are using Rackspace Cloudfiles (similar to Amazon S3) to store images. I'd like the ability to upload the file into our cloudfiles directly from our PHP Runner 5.2 application versus storing on our server. This is how we do it with a regular html/php script:
The html page:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form action="upload.php" enctype="multipart/form-data" method="POST">
File: <input name="upload" type="file" />
<input name="submit" type="submit" value="Upload To Rackspace!" />
</form>
</body>
</html>
and this is the upload.php file
<?php
// include the API
require('cloudfiles/cloudfiles.php');
// cloud info
$username = "myusername"; // username
$key = "my_key"; // api key
// Connect to Rackspace
$auth = new CF_Authentication($username, $key);
$auth->authenticate();
$conn = new CF_Connection($auth);
// Get the container we want to use
$container = $conn->get_container('container');
// store file information
$localfile = $_FILES['upload']['tmp_name'];
$filename = $_FILES['upload']['name'];
// upload file to Rackspace
$object = $container->create_object($filename);
$object->load_from_filename($localfile);
?>
How would we do this?
thank you in advance... Randall