I am trying to upload a file to the rackspace cloud file using the following code:
Upload.html
<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>
upload.php
<?php
require('cloudfiles.php');
$username = "";
$key = "";
$auth = new CF_Authentication($username, $key);
$auth->authenticate();
$conn = new CF_Connection($auth);
$container = $conn->get_container('resumetune');
$localfile = $_FILES['upload']['tmp_name'];
$filename = $_FILES['upload']['name'];
$object = $container->create_object($filename);
$object->load_from_filename($localfile);
?>
Now I get a gollowing error:
Fatal error: Throw a "BadContentTypeException" exception with the message "Required content type not set" in C: \ xampp \ htdocs \ rackspace \ cloudfiles.php: 1645 Stack trace: # 0 C: \ xampp \ htdocs \ rackspace \ cloudfiles.php (1962): CF_Object → _ guess_content_type ('C: \ xampp \ tmp \ ph ...') # 1 C: \ xampp \ htdocs \ rackspace \ upload.php (24): CF_Object-> load_from_filename ('C: \ xampp \ tmp \ ph ... ') # 2 {main} is selected in C: \ xampp \ htdocs \ rackspace \ cloudfiles.php on line 1645
Anyone have any ideas on this? thanks in advance.