Won't change mime type?
Permalink
Hey guys,
I'm trying to add more security to a block I built. Here's the code for a file I have in the /tools directory of the block:
The portion in the middle is an exact copy from some of the code used inside Concrete, and I'm sort of confused. When I debug the mime type variable comes up as blank, and the mime type of the response comes up as "text/html".
This messes up Flash Player, and it will not stream the video.
Do you know how I can fix this?
I'm trying to add more security to a block I built. Here's the code for a file I have in the /tools directory of the block:
<?php defined('C5_EXECUTE') or die(_("Access Denied.")); $b = Block::getByID (intval ($_SERVER['QUERY_STRING'])); $bp = new Permissions ($b); if ($b && $bp -> canRead () && strpos ($_SERVER['HTTP_REFERER'], BASE_URL . DIR_REL) > -1) { $c = $b -> getInstance (); $file = $c -> getFileObject(); $mimeType = $file->getMimeType(); $fc = Loader::helper('file'); $contents = $fc->getContents($file->getPath()); header("Content-type: $mimeType"); print $contents; exit; } else { echo "Access Denied.";
Viewing 15 lines of 17 lines. View entire code block.
The portion in the middle is an exact copy from some of the code used inside Concrete, and I'm sort of confused. When I debug the mime type variable comes up as blank, and the mime type of the response comes up as "text/html".
This messes up Flash Player, and it will not stream the video.
Do you know how I can fix this?
-Scott