本文整理汇总了PHP中kFile::mimeType方法的典型用法代码示例。如果您正苦于以下问题:PHP kFile::mimeType方法的具体用法?PHP kFile::mimeType怎么用?PHP kFile::mimeType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kFile
的用法示例。
在下文中一共展示了kFile::mimeType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute()
{
$this->forceSystemAuthentication();
$file_path = $this->getP("file_path");
if (!file_exists($file_path)) {
echo "Cannot find file [{$file_path}]";
die;
}
$mime_type = kFile::mimeType($file_path);
// echo "[[$mime_type]]";
kFile::dumpFile($file_path, $mime_type);
die;
}
示例2: serveUpdateAction
/**
* Serve update file
*
* @action serveUpdate
* @param string $os
* @param string $version
* @return file
* @throws CaptureSpaceErrors::NO_UPDATE_IS_AVAILABLE
*/
public function serveUpdateAction($os, $version)
{
$filename = kCaptureSpaceVersionManager::getUpdateFile($os, $version);
if (!$filename) {
throw new KalturaAPIException(CaptureSpaceErrors::NO_UPDATE_IS_AVAILABLE, $version, $os);
}
$actualFilePath = myContentStorage::getFSContentRootPath() . "/content/third_party/capturespace/{$filename}";
if (!file_exists($actualFilePath)) {
throw new KalturaAPIException(CaptureSpaceErrors::NO_UPDATE_IS_AVAILABLE, $version, $os);
}
$mimeType = kFile::mimeType($actualFilePath);
header("Content-Disposition: attachment; filename=\"{$filename}\"");
return $this->dumpFile($actualFilePath, $mimeType);
}
示例3: serveAction
/**
* serve action returan the file from dataContent field.
*
* @action serve
* @serverOnly
* @param string $entryId Data entry id
* @param int $version Desired version of the data
* @param bool $forceProxy force to get the content without redirect
*
* @throws KalturaErrors::ENTRY_ID_NOT_FOUND
*/
function serveAction($entryId, $version = -1, $forceProxy = false)
{
$dbEntry = entryPeer::retrieveByPK($entryId);
if (!$dbEntry || $dbEntry->getType() != KalturaEntryType::DATA) {
throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId);
}
$ksObj = $this->getKs();
$ks = $ksObj ? $ksObj->getOriginalString() : null;
$securyEntryHelper = new KSecureEntryHelper($dbEntry, $ks, null);
$securyEntryHelper->validateForDownload();
if (!$version || $version == -1) {
$version = null;
}
$fileName = $dbEntry->getName();
$syncKey = $dbEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA, $version);
list($fileSync, $local) = kFileSyncUtils::getReadyFileSyncForKey($syncKey, true, false);
header("Content-Disposition: attachment; filename=\"{$fileName}\"");
if ($local) {
$filePath = $fileSync->getFullPath();
$mimeType = kFile::mimeType($filePath);
kFile::dumpFile($filePath, $mimeType);
} else {
$remoteUrl = kDataCenterMgr::getRedirectExternalUrl($fileSync);
KalturaLog::info("Redirecting to [{$remoteUrl}]");
if ($forceProxy) {
kFile::dumpUrl($remoteUrl);
} else {
// or redirect if no proxy
header("Location: {$remoteUrl}");
}
}
}
示例4: dumpFile
private function dumpFile($file_path, $file_name, $wams_asset_id = null, $wams_url = null)
{
$relocate = $this->getRequestParameter("relocate");
$directServe = $this->getRequestParameter("direct_serve");
if (!$relocate) {
$url = $_SERVER["REQUEST_URI"];
if (strpos($url, "?") !== false) {
$url .= "&relocate=";
} else {
$url .= "/relocate/";
}
$url .= $this->encodeUrl($file_name);
kFile::cacheRedirect($url);
header("Location: {$url}");
die;
} else {
if (!$directServe) {
header("Content-Disposition: attachment; filename=\"{$file_name}\"");
}
if (!empty($wams_asset_id)) {
$fileSync = FileSyncPeer::retrieveByWamsAssetId($wams_asset_id);
kWAMS::getInstance($fileSync->getPartnerId())->dumpFile($wams_asset_id, pathinfo($file_name, PATHINFO_EXTENSION));
} else {
$mime_type = kFile::mimeType($file_path);
kFile::dumpFile($file_path, $mime_type);
}
}
}
示例5: setFlavorAsset
public function setFlavorAsset(DOMElement $item, array $flavorAssets, $flavorLang)
{
$flavorAsset = $flavorAssets[0];
/* @var $flavorAsset flavorAsset */
$url = $this->getAssetUrl($flavorAsset);
kXml::setNodeValue($this->xpath, 'media:content/@url', $url, $item);
kXml::setNodeValue($this->xpath, 'media:content/@width', $flavorAsset->getWidth(), $item);
kXml::setNodeValue($this->xpath, 'media:content/@height', $flavorAsset->getHeight(), $item);
//setting mime type
$syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
if (kFileSyncUtils::fileSync_exists($syncKey)) {
$filePath = kFileSyncUtils::getLocalFilePathForKey($syncKey, false);
$mimeType = kFile::mimeType($filePath);
}
kXml::setNodeValue($this->xpath, 'media:content/@type', $mimeType, $item);
if (!empty($flavorLang)) {
kXml::setNodeValue($this->xpath, 'media:content/@lang', $flavorLang, $item);
}
}
示例6: serveFlavorAsset
/**
* Serves the file content
*
* @action serve
* @param flavorAsset $flavorAsset
* @param string $fileName
* @param bool $forceProxy
* @return file
*
* @throws KalturaErrors::FLAVOR_ASSET_IS_NOT_READY
*/
protected function serveFlavorAsset(flavorAsset $flavorAsset, $fileName, $forceProxy = false)
{
$syncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
list($fileSync, $local) = kFileSyncUtils::getReadyFileSyncForKey($syncKey, true, false);
if (!$fileSync) {
throw new KalturaAPIException(KalturaErrors::FLAVOR_ASSET_IS_NOT_READY, $flavorAsset->getId());
}
/* @var $fileSync FileSync */
if ($fileSync->getFileExt() != assetParams::CONTAINER_FORMAT_SWF) {
header("Content-Disposition: attachment; filename=\"{$fileName}\"");
}
if ($local) {
$filePath = $fileSync->getFullPath();
$mimeType = kFile::mimeType($filePath);
return $this->dumpFile($filePath, $mimeType);
} else {
$remoteUrl = kDataCenterMgr::getRedirectExternalUrl($fileSync);
KalturaLog::info("Redirecting to [{$remoteUrl}]");
if ($forceProxy) {
kFileUtils::dumpUrl($remoteUrl);
} else {
// or redirect if no proxy
header("Location: {$remoteUrl}");
die;
}
}
}
示例7: serveAction
/**
* Serves thumbnail by its id
*
* @action serve
* @param string $thumbAssetId
* @param int $version
* @param KalturaThumbParams $thumbParams
* @param KalturaThumbnailServeOptions $options
* @return file
*
* @throws KalturaErrors::THUMB_ASSET_IS_NOT_READY
* @throws KalturaErrors::THUMB_ASSET_ID_NOT_FOUND
*/
public function serveAction($thumbAssetId, $version = null, KalturaThumbParams $thumbParams = null, KalturaThumbnailServeOptions $options = null)
{
if (!kCurrentContext::$ks) {
$thumbAsset = kCurrentContext::initPartnerByAssetId($thumbAssetId);
if (!$thumbAsset || $thumbAsset->getStatus() == asset::ASSET_STATUS_DELETED) {
throw new KalturaAPIException(KalturaErrors::THUMB_ASSET_ID_NOT_FOUND, $thumbAssetId);
}
// enforce entitlement
$this->setPartnerFilters(kCurrentContext::getCurrentPartnerId());
kEntitlementUtils::initEntitlementEnforcement();
} else {
$thumbAsset = assetPeer::retrieveById($thumbAssetId);
}
if (!$thumbAsset || !$thumbAsset instanceof thumbAsset) {
throw new KalturaAPIException(KalturaErrors::THUMB_ASSET_ID_NOT_FOUND, $thumbAssetId);
}
$entry = entryPeer::retrieveByPK($thumbAsset->getEntryId());
if (!$entry) {
//we will throw thumb asset not found, as the user is not entitled, and should not know that the entry exists.
throw new KalturaAPIException(KalturaErrors::THUMB_ASSET_ID_NOT_FOUND, $thumbAssetId);
}
$securyEntryHelper = new KSecureEntryHelper($entry, kCurrentContext::$ks, null, ContextType::THUMBNAIL);
$securyEntryHelper->validateAccessControl();
$ext = $thumbAsset->getFileExt();
if (is_null($ext)) {
$ext = 'jpg';
}
$fileName = $thumbAsset->getEntryId() . "_" . $thumbAsset->getId() . ".{$ext}";
if (!$thumbParams) {
if ($options && $options->download) {
header("Content-Disposition: attachment; filename=\"{$fileName}\"");
}
return $this->serveAsset($thumbAsset, $fileName, $version);
}
$thumbParams->validate();
$syncKey = $thumbAsset->getSyncKey(asset::FILE_SYNC_ASSET_SUB_TYPE_ASSET, $version);
if (!kFileSyncUtils::fileSync_exists($syncKey)) {
throw new KalturaAPIException(KalturaErrors::FILE_DOESNT_EXIST);
}
list($fileSync, $local) = kFileSyncUtils::getReadyFileSyncForKey($syncKey, true, false);
/* @var $fileSync FileSync */
if (!$local) {
if (!in_array($fileSync->getDc(), kDataCenterMgr::getDcIds())) {
throw new KalturaAPIException(KalturaErrors::FILE_DOESNT_EXIST);
}
$remoteUrl = kDataCenterMgr::getRedirectExternalUrl($fileSync);
KalturaLog::info("Redirecting to [{$remoteUrl}]");
header("Location: {$remoteUrl}");
die;
}
$filePath = $fileSync->getFullPath();
$thumbVersion = $thumbAsset->getId() . '_' . $version;
$tempThumbPath = myEntryUtils::resizeEntryImage($entry, $thumbVersion, $thumbParams->width, $thumbParams->height, $thumbParams->cropType, $thumbParams->backgroundColor, null, $thumbParams->quality, $thumbParams->cropX, $thumbParams->cropY, $thumbParams->cropWidth, $thumbParams->cropHeight, -1, 0, -1, $filePath, $thumbParams->density, $thumbParams->stripProfiles, null);
if ($options && $options->download) {
header("Content-Disposition: attachment; filename=\"{$fileName}\"");
}
$mimeType = kFile::mimeType($tempThumbPath);
return $this->dumpFile($tempThumbPath, $mimeType);
}
示例8: serveAction
/**
* serve action returns the original file.
*
* @action serve
* @param int $id job id
* @return file
*
*/
function serveAction($id)
{
$c = new Criteria();
$c->addAnd(BatchJobPeer::ID, $id);
$c->addAnd(BatchJobPeer::PARTNER_ID, $this->getPartnerId());
$c->addAnd(BatchJobPeer::JOB_TYPE, BatchJobType::BULKUPLOAD);
$batchJob = BatchJobPeer::doSelectOne($c);
if (!$batchJob) {
throw new KalturaAPIException(KalturaErrors::BULK_UPLOAD_NOT_FOUND, $id);
}
KalturaLog::info("Batch job found for jobid [{$id}] bulk upload type [" . $batchJob->getJobSubType() . "]");
$syncKey = $batchJob->getSyncKey(BatchJob::FILE_SYNC_BATCHJOB_SUB_TYPE_BULKUPLOAD);
list($fileSync, $local) = kFileSyncUtils::getReadyFileSyncForKey($syncKey, true, false);
header("Content-Type: text/plain; charset=UTF-8");
if ($local) {
$filePath = $fileSync->getFullPath();
$mimeType = kFile::mimeType($filePath);
return $this->dumpFile($filePath, $mimeType);
} else {
$remoteUrl = kDataCenterMgr::getRedirectExternalUrl($fileSync);
KalturaLog::info("Redirecting to [{$remoteUrl}]");
header("Location: {$remoteUrl}");
die;
}
}
示例9: execute
/**
* Will forward to the regular swf player according to the widget_id
*/
public function execute()
{
requestUtils::handleConditionalGet();
$entry_id = $this->getRequestParameter("entry_id");
$type = $this->getRequestParameter("type");
$ks = $this->getRequestParameter("ks");
$file_sync = null;
$ret_file_name = "name";
$referrer = $this->getRequestParameter("referrer");
$referrer = base64_decode($referrer);
if (!is_string($referrer)) {
// base64_decode can return binary data
$referrer = "";
}
$request_file_name = $this->getRequestParameter("file_name");
if ($request_file_name) {
$ret_file_name = $request_file_name;
}
$direct_serve = $this->getRequestParameter("direct_serve");
$entry = entryPeer::retrieveByPK($entry_id);
if (!$entry) {
// what to return ??
die;
}
myPartnerUtils::blockInactivePartner($entry->getPartnerId());
$securyEntryHelper = new KSecureEntryHelper($entry, $ks, $referrer);
$securyEntryHelper->validateForDownload();
// Rmoved by Tan-Tan - asked by Eran
// // allow access only via cdn unless these are documents (due to the current implementation of convert ppt2swf)
// if ($entry->getType() != entryType::DOCUMENT && $entry->getMediaType() != entry::ENTRY_MEDIA_TYPE_IMAGE)
// {
// requestUtils::enforceCdnDelivery($entry->getPartnerId());
// }
// relocate = did we use the redirect and added the extension to the name
$relocate = $this->getRequestParameter("relocate");
if ($ret_file_name == "name") {
$ret_file_name = $entry->getName();
}
if ($ret_file_name) {
//rawurlencode to content-disposition filename to handle spaces and other characters across different browsers
//$name = rawurlencode($ret_file_name);
// 19.04.2009 (Roman) - url encode is not needed when the filename in Content-Disposition header is in quotes
// IE6/FF3/Chrome - Will show the filename correctly
// IE7 - Will show the filename with underscores instead of spaces (this is better than showing %20)
$name = $ret_file_name;
if ($name) {
if ($relocate) {
// if we have a good file extension (from the first time) - use it in the content-disposition
// in some browsers it will be stronger than the URL's extension
$file_ext = pathinfo($relocate, PATHINFO_EXTENSION);
$name .= ".{$file_ext}";
}
if (!$direct_serve) {
header("Content-Disposition: attachment; filename=\"{$name}\"");
}
}
} else {
$ret_file_name = $entry_id;
}
$format = $this->getRequestParameter("format");
if ($type == "download" && $format && $entry->getType() != entryType::DOCUMENT) {
// this is a video for a specifc extension - use the proper flavorAsset
$flavor_asset = flavorAssetPeer::retrieveByEntryIdAndExtension($entry_id, $format);
if ($flavor_asset && $flavor_asset->getStatus() == flavorAsset::FLAVOR_ASSET_STATUS_READY) {
$file_sync = $this->redirectIfRemote($flavor_asset, flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET, null, true);
} else {
header('KalturaRaw: no flavor asset for extension');
header("HTTP/1.0 404 Not Found");
die;
}
$archive_file = $file_sync->getFullPath();
$mime_type = kFile::mimeType($archive_file);
kFile::dumpFile($archive_file, $mime_type);
}
// TODO - move to a different action - document should be plugin
if ($entry->getType() == entryType::DOCUMENT) {
// use the fileSync from the entry
if ($type == "download" && $format) {
$flavor_asset = flavorAssetPeer::retrieveByEntryIdAndExtension($entry_id, $format);
} else {
$flavor_asset = flavorAssetPeer::retrieveOriginalByEntryId($entry_id);
}
if ($flavor_asset && $flavor_asset->getStatus() == flavorAsset::FLAVOR_ASSET_STATUS_READY) {
$file_sync = $this->redirectIfRemote($flavor_asset, flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET, null, true);
} else {
header('KalturaRaw: no flavor asset for extension');
header("HTTP/1.0 404 Not Found");
die;
}
// Gonen 2010-08-05 workaround to make sure file name includes correct extension
// make sure a file extension is added to the downloaded file so browser will identify and
// allow opening with default program
// for direct serve we do not want to send content-disposition header
if (!$direct_serve) {
$ext = pathinfo($file_sync->getFullPath(), PATHINFO_EXTENSION);
if ($relocate) {
// remove relocate file extension
//.........这里部分代码省略.........
示例10: serveFile
/**
* @param ISyncableFile $syncable
* @param int $fileSubType
* @param string $fileName
* @param bool $forceProxy
* @throws KalturaErrors::FILE_DOESNT_EXIST
*/
protected function serveFile(ISyncableFile $syncable, $fileSubType, $fileName, $entryId = null, $forceProxy = false)
{
/* @var $fileSync FileSync */
$syncKey = $syncable->getSyncKey($fileSubType);
if (!kFileSyncUtils::fileSync_exists($syncKey)) {
throw new KalturaAPIException(KalturaErrors::FILE_DOESNT_EXIST);
}
list($fileSync, $local) = kFileSyncUtils::getReadyFileSyncForKey($syncKey, true, false);
header("Content-Disposition: attachment; filename=\"{$fileName}\"");
if ($local) {
$filePath = $fileSync->getFullPath();
$wamsAssetId = $fileSync->getWamsAssetId();
if (empty($wamsAssetId)) {
$mimeType = kFile::mimeType($filePath);
kFile::dumpFile($filePath, $mimeType);
} else {
kWAMS::getInstance($fileSync->getPartnerId())->dumpFile($wamsAssetId, pathinfo($filePath, PATHINFO_EXTENSION));
}
} else {
if (in_array($fileSync->getDc(), kDataCenterMgr::getDcIds())) {
$remoteUrl = kDataCenterMgr::getRedirectExternalUrl($fileSync);
KalturaLog::info("Redirecting to [{$remoteUrl}]");
if ($forceProxy) {
kFile::dumpApiRequest($remoteUrl);
} else {
//TODO find or build function which redurects the API request with all its parameters without using curl.
// or redirect if no proxy
header("Location: {$remoteUrl}");
die;
}
} else {
$remoteUrl = $fileSync->getExternalUrl($entryId);
header("Location: {$remoteUrl}");
die;
}
}
}
示例11: serveFile
/**
* @param ISyncableFile $syncable
* @param int $fileSubType
* @param string $fileName
* @param bool $forceProxy
* @throws KalturaErrors::FILE_DOESNT_EXIST
*/
protected function serveFile(ISyncableFile $syncable, $fileSubType, $fileName, $entryId = null, $forceProxy = false)
{
/* @var $fileSync FileSync */
$syncKey = $syncable->getSyncKey($fileSubType);
if (!kFileSyncUtils::fileSync_exists($syncKey)) {
throw new KalturaAPIException(KalturaErrors::FILE_DOESNT_EXIST);
}
list($fileSync, $local) = kFileSyncUtils::getReadyFileSyncForKey($syncKey, true, false);
if ($local) {
$filePath = $fileSync->getFullPath();
$mimeType = kFile::mimeType($filePath);
return $this->dumpFile($filePath, $mimeType);
} else {
if (in_array($fileSync->getDc(), kDataCenterMgr::getDcIds())) {
$remoteUrl = kDataCenterMgr::getRedirectExternalUrl($fileSync);
KalturaLog::info("Redirecting to [{$remoteUrl}]");
if ($forceProxy) {
kFileUtils::dumpApiRequest($remoteUrl);
} else {
//TODO find or build function which redurects the API request with all its parameters without using curl.
// or redirect if no proxy
header("Location: {$remoteUrl}");
die;
}
} else {
$remoteUrl = $fileSync->getExternalUrl($entryId);
header("Location: {$remoteUrl}");
die;
}
}
}
示例12: serveDiagramAction
/**
* Server business-process case diagram
*
* @action serveDiagram
* @param KalturaEventNotificationEventObjectType $objectType
* @param string $objectId
* @param int $businessProcessStartNotificationTemplateId
* @return file
*
* @throws KalturaEventNotificationErrors::EVENT_NOTIFICATION_TEMPLATE_NOT_FOUND
* @throws KalturaBusinessProcessNotificationErrors::BUSINESS_PROCESS_CASE_NOT_FOUND
* @throws KalturaBusinessProcessNotificationErrors::BUSINESS_PROCESS_SERVER_NOT_FOUND
*/
public function serveDiagramAction($objectType, $objectId, $businessProcessStartNotificationTemplateId)
{
$dbObject = kEventNotificationFlowManager::getObject($objectType, $objectId);
if (!$dbObject) {
throw new KalturaAPIException(KalturaErrors::OBJECT_NOT_FOUND);
}
$dbTemplate = EventNotificationTemplatePeer::retrieveByPK($businessProcessStartNotificationTemplateId);
if (!$dbTemplate || !$dbTemplate instanceof BusinessProcessStartNotificationTemplate) {
throw new KalturaAPIException(KalturaEventNotificationErrors::EVENT_NOTIFICATION_TEMPLATE_NOT_FOUND, $businessProcessStartNotificationTemplateId);
}
$caseIds = $dbTemplate->getCaseIds($dbObject, false);
if (!count($caseIds)) {
throw new KalturaAPIException(KalturaBusinessProcessNotificationErrors::BUSINESS_PROCESS_CASE_NOT_FOUND);
}
$dbBusinessProcessServer = BusinessProcessServerPeer::retrieveByPK($dbTemplate->getServerId());
if (!$dbBusinessProcessServer) {
throw new KalturaAPIException(KalturaBusinessProcessNotificationErrors::BUSINESS_PROCESS_SERVER_NOT_FOUND, $dbTemplate->getServerId());
}
$businessProcessServer = KalturaBusinessProcessServer::getInstanceByType($dbBusinessProcessServer->getType());
$businessProcessServer->fromObject($dbBusinessProcessServer);
$provider = kBusinessProcessProvider::get($businessProcessServer);
$caseId = end($caseIds);
$filename = myContentStorage::getFSCacheRootPath() . 'bpm_diagram/bpm_';
$filename .= $objectId . '_';
$filename .= $businessProcessStartNotificationTemplateId . '_';
$filename .= $caseId . '.jpg';
$url = $provider->getCaseDiagram($caseId, $filename);
KCurlWrapper::getDataFromFile($url, $filename);
$mimeType = kFile::mimeType($filename);
return $this->dumpFile($filename, $mimeType);
}
示例13: dumpFile
private function dumpFile($file_path, $file_name, $limit_file_size = 0)
{
$file_name = str_replace("\n", ' ', $file_name);
$relocate = $this->getRequestParameter("relocate");
$directServe = $this->getRequestParameter("direct_serve");
if (!$relocate) {
$url = $_SERVER["REQUEST_URI"];
if (strpos($url, "?") !== false) {
$url .= "&relocate=";
} else {
$url .= "/relocate/";
}
$url .= kString::stripInvalidUrlChars($file_name);
kFile::cacheRedirect($url);
header("Location: {$url}");
KExternalErrors::dieGracefully();
} else {
if (!$directServe) {
header("Content-Disposition: attachment; filename=\"{$file_name}\"");
}
$mime_type = kFile::mimeType($file_path);
kFileUtils::dumpFile($file_path, $mime_type, null, $limit_file_size);
}
}
示例14: serveThumbToFile
/**
* @param FileSync $fileSync
* @param bool $local
* @param string $fileName
* @param bool $forceProxy
*/
protected function serveThumbToFile(FileSync $fileSync, $local, $fileName, $forceProxy = false)
{
header("Content-Disposition: attachment; filename=\"{$fileName}\"");
if ($local) {
$filePath = $fileSync->getFullPath();
$mimeType = kFile::mimeType($filePath);
kFile::dumpFile($filePath, $mimeType);
} else {
$remoteUrl = kDataCenterMgr::getRedirectExternalUrl($fileSync);
KalturaLog::info("Redirecting to [{$remoteUrl}]");
if ($forceProxy) {
kFile::dumpUrl($remoteUrl);
} else {
// or redirect if no proxy
header("Location: {$remoteUrl}");
}
}
}
示例15: dumpFile
private function dumpFile($file_path, $file_name)
{
$relocate = $this->getRequestParameter("relocate");
$directServe = $this->getRequestParameter("direct_serve");
if (!$relocate) {
$url = $_SERVER["REQUEST_URI"];
if (strpos($url, "?") !== false) {
$url = substr($url, 0, strpos($url, "?"));
}
$url .= "/relocate/" . $this->encodeUrl($file_name);
header("Location: {$url}");
die;
} else {
if (!$directServe) {
header("Content-Disposition: attachment; filename=\"{$file_name}\"");
}
$mime_type = kFile::mimeType($file_path);
kFile::dumpFile($file_path, $mime_type);
}
}