当前位置: 首页>>代码示例>>PHP>>正文


PHP UploadHandler::_processed方法代码示例

本文整理汇总了PHP中UploadHandler::_processed方法的典型用法代码示例。如果您正苦于以下问题:PHP UploadHandler::_processed方法的具体用法?PHP UploadHandler::_processed怎么用?PHP UploadHandler::_processed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UploadHandler的用法示例。


在下文中一共展示了UploadHandler::_processed方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: processRequest

 public function processRequest()
 {
     // Ignore other requests except POST.
     if ($_SERVER['REQUEST_METHOD'] !== 'POST' || empty($_POST[PostFields::packageGuid])) {
         return;
     }
     if (UploadHandler::$_processed) {
         return;
     }
     UploadHandler::$_processed = true;
     if (array_key_exists('HTTP_X_PREPROCESS_REQUIRED', $_SERVER) && $_SERVER['HTTP_X_PREPROCESS_REQUIRED'] == 'true') {
         $files = $this->getRequestFiles($_POST);
     } else {
         $files =& $_FILES;
     }
     $uploadCache = new UploadCache($this->_cacheRoot);
     $uploadSession = new UploadSession($uploadCache, $_POST, $files, $_SERVER);
     if (!empty($this->_allFilesUploadedCallback)) {
         $uploadSession->setAllFilesUploadedCallback($this->_allFilesUploadedCallback);
     }
     if (!empty($this->_fileUploadedCallback)) {
         $uploadSession->setFileUploadedCallback($this->_fileUploadedCallback);
     }
     $uploadSession->processRequest();
     $this->removeExpiredSessions($uploadCache);
     // Flash requires non-empty response
     if (!headers_sent() && array_key_exists('HTTP_USER_AGENT', $_SERVER) && $_SERVER['HTTP_USER_AGENT'] === 'Shockwave Flash') {
         echo '0';
     }
 }
开发者ID:Satariall,项目名称:izurit,代码行数:30,代码来源:UploadHandler.class.php

示例2: processUploads

	/**
	 * Processes server and $_FILE info relating to uploads to produce usable info. Assigns all gathered data to class variables which are accessible via public methods.
	 *
	 * @return void
	 * @throws UploadHandlerProcessPostSizeException If the posted data size exceeds the maximum post size defined by php configuration
	 * @throws UploadHandlerProcessNoInputException If no files were uploaded
	 */
	public static function processUploads()
	{
		if (self::$_processed) {
			return;
		}

		self::$_processed = true;

		self::$files = array();

		if (self::$contentLength >= self::$maxPostSize) {
			//	post length exceeds maximum post length ini directive - impossible for php to parse uploaded files because $_FILES is empty
			throw new UploadHandlerProcessPostSizeException(sprintf(self::$i18n['UPLOADHANDLER_ERR_PROCESS_POST_SIZE'], self::$contentLength, self::$maxPostSize));
		}

		if (empty($_FILES)) {
			//	no files uploaded
			throw new UploadHandlerProcessNoInputException(self::$i18n['UPLOADHANDLER_ERR_PROCESS_NO_INPUT']);
		}

		foreach ($_FILES as $fieldName => $field) {

			if (is_array($field['name'])) {
				//	input field that uses [] in it's name

				self::$files[$fieldName] = array();

				foreach ($field['name'] as $index => $ignoreThisValue) {
					$name = $field['name'][$index];
					$type = $field['type'][$index];
					$tmp_name = $field['tmp_name'][$index];
					$error = intval($field['error'][$index]);
					$size = intval($field['size'][$index]);

					$file = new UploadHandlerFile($fieldName, $name, $type, $tmp_name, $error, $size);

					self::$files[$fieldName][] = $file;
				}

			} else {
				//	single input field
				$name = $field['name'];
				$type = $field['type'];
				$tmp_name = $field['tmp_name'];
				$error = intval($field['error']);
				$size = intval($field['size']);

				$file = new UploadHandlerFile($fieldName, $name, $type, $tmp_name, $error, $size);

				self::$files[$fieldName] = array($file);
			}
		}
	}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:60,代码来源:uploadhandler.php


注:本文中的UploadHandler::_processed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。