本文整理汇总了PHP中UploadHandler::generate_response方法的典型用法代码示例。如果您正苦于以下问题:PHP UploadHandler::generate_response方法的具体用法?PHP UploadHandler::generate_response怎么用?PHP UploadHandler::generate_response使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UploadHandler
的用法示例。
在下文中一共展示了UploadHandler::generate_response方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generate_response
public function generate_response($content, $print_response = true)
{
if ($print_response && !empty($content['files'])) {
foreach ($content['files'] as $key => $content_image_data) {
if (!empty($this->options['selected_data'][$content_image_data->name])) {
foreach (get_object_vars($this->options['selected_data'][$content_image_data->name]) as $var => $data) {
$content['files'][$key]->{$var} = $data;
}
}
}
usort($content['files'], ['self', 'order_items']);
}
return parent::generate_response($content, $print_response);
}
示例2: array
include_once GLPI_ROOT . '/lib/jqueryplugins/jquery-file-upload/server/php/UploadHandler.php';
$errors = array(1 => __('The uploaded file exceeds the upload_max_filesize directive in php.ini'), 2 => __('The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form'), 3 => __('The uploaded file was only partially uploaded'), 4 => __('No file was uploaded'), 6 => __('Missing a temporary folder'), 7 => __('Failed to write file to disk'), 8 => __('A PHP extension stopped the file upload'), 'post_max_size' => __('The uploaded file exceeds the post_max_size directive in php.ini'), 'max_file_size' => __('File is too big'), 'min_file_size' => __('File is too small'), 'accept_file_types' => __('Filetype not allowed'), 'max_number_of_files' => __('Maximum number of files exceeded'), 'max_width' => __('Image exceeds maximum width'), 'min_width' => __('Image requires a minimum width'), 'max_height' => __('Image exceeds maximum height'), 'min_height' => __('Image requires a minimum height'));
$upload_dir = GLPI_TMP_DIR . '/';
$upload_handler = new UploadHandler(array('upload_dir' => $upload_dir, 'param_name' => $_GET['name'], 'orient_image' => false, 'image_versions' => array()), false, $errors);
$response = $upload_handler->post(false);
// clean compute display filesize
if (isset($response[$_GET['name']]) && is_array($response[$_GET['name']])) {
foreach ($response[$_GET['name']] as $key => &$val) {
if (Document::isValidDoc(addslashes($val->name))) {
if (isset($val->name)) {
$val->display = $val->name;
}
if (isset($val->size)) {
$val->filesize = Toolbox::getSize($val->size);
if (isset($_GET['showfilesize']) && $_GET['showfilesize']) {
$val->display = sprintf('%1$s %2$s', $val->display, $val->filesize);
}
}
} else {
// Unlink file
$val->error = $errors['accept_file_types'];
if (file_exists($upload_dir . $val->name)) {
@unlink($upload_dir . $val->name);
}
}
$val->id = 'doc' . $_GET['name'] . mt_rand();
}
}
// Ajout du Doc + generation tag + autre traitement
$upload_handler->generate_response($response);
示例3: generate_response
protected function generate_response($content, $print_response = true)
{
parent::generate_response($content, false);
}