<?
class MimeFile {
var $record;
function MimeFile($file_id) {
global $db;
if (!isset($file_id) || $file_id <0) {
Error::showErr("Could not output image: invalid file id");
} else {
$this->record = $db->getOneRecord("item","item_id=$file_id")
or Error::showErr("Can't find file to output");
}
} // end of constructor
function display() {
// Output the MIME header
header("Content-Type: {$this->record["item_mime"]}");
//echo "MUGI";
// Output the file or image
echo Text::restoreStr($this->record["item_content"]);
}
}
?>