本文整理匯總了PHP中UploadBase::stashFile方法的典型用法代碼示例。如果您正苦於以下問題:PHP UploadBase::stashFile方法的具體用法?PHP UploadBase::stashFile怎麽用?PHP UploadBase::stashFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UploadBase
的用法示例。
在下文中一共展示了UploadBase::stashFile方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: performStash
/**
* Stash the file and return the file key
* Also re-raises exceptions with slightly more informative message strings (useful for API)
* @throws MWException
* @return String file key
*/
function performStash()
{
try {
$fileKey = $this->mUpload->stashFile()->getFileKey();
} catch (MWException $e) {
$message = 'Stashing temporary file failed: ' . get_class($e) . ' ' . $e->getMessage();
wfDebug(__METHOD__ . ' ' . $message . "\n");
throw new MWException($message);
}
return $fileKey;
}
示例2: performStash
/**
* Stash the file and return the file key
* Also re-raises exceptions with slightly more informative message strings (useful for API)
* @throws MWException
* @return string File key
*/
private function performStash()
{
try {
$stashFile = $this->mUpload->stashFile($this->getUser());
if (!$stashFile) {
throw new MWException('Invalid stashed file');
}
$fileKey = $stashFile->getFileKey();
} catch (Exception $e) {
$message = 'Stashing temporary file failed: ' . get_class($e) . ' ' . $e->getMessage();
wfDebug(__METHOD__ . ' ' . $message . "\n");
$className = get_class($e);
throw new $className($message);
}
return $fileKey;
}
示例3: stashFile
/**
* Stash the file.
*
* @param User $user
* @return UploadStashFile
*/
public function stashFile(User $user = null)
{
// replace mLocalFile with an instance of UploadStashFile, which adds some methods
// that are useful for stashed files.
$this->mLocalFile = parent::stashFile($user);
return $this->mLocalFile;
}
示例4: stashFile
/**
* There is no need to stash the image twice
*/
public function stashFile($key = null)
{
if (!empty($this->mLocalFile)) {
return $this->mLocalFile;
}
return parent::stashFile($key);
}