本文整理匯總了PHP中UploadBase::getTempPath方法的典型用法代碼示例。如果您正苦於以下問題:PHP UploadBase::getTempPath方法的具體用法?PHP UploadBase::getTempPath怎麽用?PHP UploadBase::getTempPath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UploadBase
的用法示例。
在下文中一共展示了UploadBase::getTempPath方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: unsaveUploadedFile
/**
* Remove a temporarily kept file stashed by saveTempUploadedFile().
*
* @return Boolean: success
*/
protected function unsaveUploadedFile() {
if ( !( $this->mUpload instanceof UploadFromStash ) ) {
return true;
}
$success = $this->mUpload->unsaveUploadedFile();
if ( !$success ) {
$this->getOutput()->showFileDeleteError( $this->mUpload->getTempPath() );
return false;
} else {
return true;
}
}
示例2: onUploadVerifyFile
/**
* Verifies image being uploaded whether it's not corrupted
*
* @author macbre
*
* @param UploadBase $upload
* @param string $mime
* @param array $error
* @return bool
*/
public static function onUploadVerifyFile(UploadBase $upload, $mime, &$error)
{
// only check supported images
$mimeTypes = array('image/gif', 'image/jpeg', 'image/png');
if (!in_array($mime, $mimeTypes)) {
return true;
}
// validate an image using ImageMagick
$imageFile = $upload->getTempPath();
$output = wfShellExec("identify -regard-warnings {$imageFile} 2>&1", $retVal);
wfDebug("Exit code #{$retVal}\n{$output}\n");
$isValid = $retVal === 0;
if (!$isValid) {
Wikia::log(__METHOD__, 'failed', rtrim($output), true);
// pass an error to UploadBase class
$error = array('verification-error');
}
return $isValid;
}
示例3: getTempPath
private function getTempPath(UploadBase $upload_base)
{
$temp_path = $upload_base->getTempPath();
if ($temp_path === '' || $temp_path === null) {
throw new \Exception('newmanuscript-error-nofile');
}
return $temp_path;
}