简体   繁体   中英

Reading a document from Rackspace CloudFiles using API

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM