作者:golfcrseve
项目:scsupe
function GetResourceTypeDirectory($resourceType, $sCommand)
{
global $config;
if ($sCommand == "QuickUpload") {
if (strlen($config['QuickUploadAbsolutePath'][$resourceType]) > 0) {
return $config['QuickUploadAbsolutePath'][$resourceType];
}
// Map the "UserFiles" path to a local directory.
return Server_MapPath($config['QuickUploadPath'][$resourceType]);
} else {
if (strlen($config['FileTypesAbsolutePath'][$resourceType]) > 0) {
return $config['FileTypesAbsolutePath'][$resourceType];
}
// Map the "UserFiles" path to a local directory.
return Server_MapPath($config['FileTypesPath'][$resourceType]);
}
}
作者:BGCX26
项目:zhishuicms-svn-to-gi
function output_file($cmd, $file_name, $file_dir, $formername, $mime = 'application/octet-stream')
{
$path = Server_MapPath($file_dir . $file_name);
if (!file_exists($path)) {
echo "Îļþ²»´æÔÚ";
exit;
} else {
$file = fopen($path, "r");
$filesize = filesize($path);
Header("Content-type: {$mime}");
Header("Accept-Ranges: bytes");
Header("Accept-Length: " . $filesize);
if ($cmd == "download") {
Header("Content-Disposition: attachment; filename=" . $formername);
}
echo fread($file, $filesize);
fclose($file);
}
}