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