當前位置: 首頁>>代碼示例>>PHP>>正文


PHP UploadBase::getTempPath方法代碼示例

本文整理匯總了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;
		}
	}
開發者ID:nahoj,項目名稱:mediawiki_ynh,代碼行數:17,代碼來源:SpecialUpload.php

示例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;
 }
開發者ID:Tjorriemorrie,項目名稱:app,代碼行數:29,代碼來源:Wikia.php

示例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;
 }
開發者ID:akvankorlaar,項目名稱:manuscriptdesk,代碼行數:8,代碼來源:NewManuscriptImageValidator.php


注:本文中的UploadBase::getTempPath方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。