extranet/www/datafile.php

26 lines
619 B
PHP

<?php
$file = $_REQUEST['q'];
$type = $_REQUEST['type'];
switch($type){
case 'pdf':
$content_type = 'application/pdf';
$path = PATH_DATA.'/pdf/';
break;
case 'logos':
$explode = explode('.', $file);
switch($explode[1]){
case 'png': $content_type = 'image/png'; break;
case 'gif': $content_type = 'image/gif'; break;
case 'jpeg':
case 'jpg': $content_type = 'image/jpeg'; break;
}
$path = PATH_DATA.'/logos/';
break;
default: exit; break;
}
$firephp->log('path',$path.$file);
if(file_exists($path.$file)){
header("Content-type: $content_type");
print file_get_contents($path.$file);
}
?>