views:

40

answers:

1

Hi - i have been using RackSpace CloudFiles to store certain images. I have the upload code working perfectly but when I try and read the image from CloudFiles it wont display it. The images wont render into the browser. The file is definitely being read as I can see the actual data from it but if I try and put in a header to render it out as an image it doesnt work. Is my code wrong?

$auth = new CF_Authentication("x", "x");
$auth->authenticate();
$conn = new CF_Connection($auth);
$cont = $conn->get_container("attachments");
$attachment = $cont->get_object("test.gif");
header("Content-Type: " . $attachment->content_type);
$output = fopen("php://output", "w");
$attachment->stream($output);
fclose($output);
A: 

sorted - very silly mistake! had a little space before the opening php bracket meaning there was output before the header! Silly silly silly

Christopher McCann