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