本文整理汇总了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);
}