本文整理汇总了PHP中FileManager::uploadedFileExists方法的典型用法代码示例。如果您正苦于以下问题:PHP FileManager::uploadedFileExists方法的具体用法?PHP FileManager::uploadedFileExists怎么用?PHP FileManager::uploadedFileExists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileManager
的用法示例。
在下文中一共展示了FileManager::uploadedFileExists方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fileUpload
/**
* Upload a new file.
*/
function fileUpload($args)
{
FilesHandler::parseDirArg($args, $currentDir, $parentDir);
$currentPath = FilesHandler::getRealFilesDir($currentDir);
import('lib.pkp.classes.file.FileManager');
$fileMgr = new FileManager();
if ($fileMgr->uploadedFileExists('file')) {
$destPath = $currentPath . '/' . FilesHandler::cleanFileName($fileMgr->getUploadedFileName('file'));
@$fileMgr->uploadFile('file', $destPath);
}
Request::redirect(null, null, 'files', explode('/', $currentDir));
}
示例2: fileUpload
/**
* Upload a new file.
* @param $args array
* @param $request PKPRequest
*/
function fileUpload($args, $request)
{
$this->validate();
$this->_parseDirArg($args, $currentDir, $parentDir);
$currentPath = $this->_getRealFilesDir($request, $currentDir);
import('lib.pkp.classes.file.FileManager');
$fileManager = new FileManager();
if ($fileManager->uploadedFileExists('file')) {
$destPath = $currentPath . '/' . $this->_cleanFileName($fileManager->getUploadedFileName('file'));
@$fileManager->uploadFile('file', $destPath);
}
$request->redirect(null, null, 'files', explode('/', $currentDir));
}
示例3: fileUpload
/**
* Upload a new file.
* @param $args array
* @param $request PKPRequest
*/
function fileUpload($args, &$request)
{
$this->validate();
$this->_parseDirArg($args, $currentDir, $parentDir);
$currentPath = $this->_getRealFilesDir($request, $currentDir);
import('lib.pkp.classes.file.FileManager');
$fileManager = new FileManager();
if ($success = $fileManager->uploadedFileExists('file')) {
$destPath = $currentPath . '/' . $this->_cleanFileName($fileManager->getUploadedFileName('file'));
$success = $fileManager->uploadFile('file', $destPath);
}
if (!$success) {
$templateMgr =& TemplateManager::getManager($request);
$this->setupTemplate($request, true);
$templateMgr->assign('pageTitle', 'manager.filesBrowser');
$templateMgr->assign('message', 'common.uploadFailed');
$templateMgr->assign('backLink', $request->url(null, null, null, 'files', explode('/', $currentDir)));
$templateMgr->assign('backLinkLabel', 'manager.filesBrowser');
return $templateMgr->display('common/message.tpl');
}
$request->redirect(null, null, null, 'files', explode('/', $currentDir));
}
示例4: uploadEmails
/**
* Upload a custom email template file
* @param $args array
* @param $request PKPRequest
*/
function uploadEmails($args, $request)
{
$this->validate();
import('lib.pkp.classes.file.FileManager');
$fileManager = new FileManager();
$journal = $request->getJournal();
$journalId = $journal->getId();
$uploadName = 'email_file';
$fileName = $fileManager->getUploadedFileName($uploadName);
if (!$fileName) {
$request->redirect(null, null, 'emails');
}
$filesDir = Config::getVar('files', 'files_dir');
$filePath = $filesDir . '/journals/' . $journalId . '/' . $fileName;
if (!$fileManager->uploadError($uploadName)) {
if ($fileManager->uploadedFileExists($uploadName)) {
$uploadedFilePath = $fileManager->getUploadedFilePath($uploadName);
if ($this->_saveEmailTemplates($uploadedFilePath, $journal)) {
if ($fileManager->deleteFile($uploadedFilePath)) {
$this->_showMessage($request);
$request->redirect(null, null, 'emails');
}
}
}
}
$this->_showMessage($request, false);
$request->redirect(null, null, 'emails');
}