本文整理汇总了PHP中UploadHandler::get_response方法的典型用法代码示例。如果您正苦于以下问题:PHP UploadHandler::get_response方法的具体用法?PHP UploadHandler::get_response怎么用?PHP UploadHandler::get_response使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UploadHandler
的用法示例。
在下文中一共展示了UploadHandler::get_response方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upload
public function upload($options = null)
{
if (!isset($options['print_response'])) {
$options['print_response'] = false;
}
$upload = new \UploadHandler($options);
return $upload->get_response();
}
示例2: json_encode
} else {
if ($entity_name == "temp") {
//redirect uploaded content back to client side after some processing
// for example in term list import
$options = array('upload_dir' => HEURIST_FILESTORE_DIR . 'scratch/', 'upload_url' => HEURIST_FILESTORE_URL . 'scratch/', 'max_file_size' => @$_REQUEST['max_file_size']);
} else {
$options = array('upload_dir' => HEURIST_FILESTORE_DIR . 'entity/' . $entity_name . '/', 'upload_url' => HEURIST_FILESTORE_URL . 'entity/' . $entity_name . '/', 'unique_filename' => false, 'newfilename' => @$_REQUEST['newfilename'], 'correct_image_extensions' => true, 'image_versions' => array('thumbnail' => array('max_width' => 120, 'max_height' => 120, 'scale_to_png' => true)));
}
}
$options['print_response'] = false;
$upload_handler = new UploadHandler($options);
// from 3d party uploader
//@todo set print_response=false
//and send to client standard HEURIST response
$response = null;
$res = $upload_handler->get_response();
foreach ($res['files'] as $file) {
if (@$file->error) {
$response = $system->addError(HEURIST_UNKNOWN_ERROR, "File cannot be processed", $file->error);
break;
}
}
if ($response == null) {
$response = array("status" => HEURIST_OK, "data" => $res);
}
header('Content-type: application/json');
print json_encode($response);
//
// verification of uploaded file - @todo integrate with UploadHandler
//
function postmode_file_selection()
示例3: json_encode
<?php
session_start();
$_SESSION['file_name'] = false;
require 'UploadHandler.php';
$upload_handler = new UploadHandler(array('accept_file_types' => '/\\.(gif|jpe?g|png)$/i', 'user_dirs' => true, 'print_response' => false, 'image_versions' => array('' => array('auto_orient' => true), 'thumbnail' => array('max_width' => 200, 'max_height' => 200))));
//get default
$responseFromUploader = $upload_handler->get_response();
$files = $responseFromUploader['files'];
$absPath = false;
foreach ($files as $file) {
$_SESSION['file_name'] = $file->name;
}
header('Content-type: application/json');
echo json_encode($upload_handler->get_response());