phpBB API Documentation
Class

phpbb\plupload\plupload

class plupload

This class handles all server-side plupload functions

Methods

__construct(string $phpbb_root_path, config $config, request_interface $request, user $user, IniGetWrapper $php_ini, guesser $mimetype_guesser)

Constructor.

array|null handle_upload(string $form_name)

Plupload allows for chunking so we must check for that and assemble the whole file first before performing any checks on it.

null configure(service $cache, template $template, string $s_action, int $forum_id, int $max_files)

Fill in the plupload configuration options in the template

bool is_active()

Checks whether the page request was sent by plupload or not

bool is_multipart()

Returns whether the current HTTP request is a multipart request.

null emit_error(int $code, string $msg)

Sends an error message back to the client via JSON response

string generate_filter_string(service $cache, string $forum_id)

Looks at the list of allowed extensions and generates a string appropriate for use in configuring plupload with

string generate_resize_string()

Generates a string that is used to tell plupload to automatically resize files before uploading them.

int get_chunk_size()

Checks various php.ini values and the maximum file size to determine the maximum size chunks a file can be split up into for upload

null set_upload_directories(string $upload_directory, string $temporary_directory)

Sets the upload directories to the specified paths

Details

at line 73
public __construct(string $phpbb_root_path, config $config, request_interface $request, user $user, IniGetWrapper $php_ini, guesser $mimetype_guesser)

Constructor.

Parameters

string $phpbb_root_path
config $config
request_interface $request
user $user
IniGetWrapper $php_ini
guesser $mimetype_guesser

at line 95
public array|null handle_upload(string $form_name)

Plupload allows for chunking so we must check for that and assemble the whole file first before performing any checks on it.

Parameters

string $form_name The name of the file element in the upload form

Return Value

array|null null if there are no chunks to piece together otherwise array containing the path to the pieced-together file and its size

at line 155
public null configure(service $cache, template $template, string $s_action, int $forum_id, int $max_files)

Fill in the plupload configuration options in the template

Parameters

service $cache
template $template
string $s_action The URL to submit the POST data to
int $forum_id The ID of the forum
int $max_files Maximum number of files allowed. 0 for unlimited.

Return Value

null

at line 180
public bool is_active()

Checks whether the page request was sent by plupload or not

Return Value

bool

at line 190
public bool is_multipart()

Returns whether the current HTTP request is a multipart request.

Return Value

bool

at line 205
public null emit_error(int $code, string $msg)

Sends an error message back to the client via JSON response

Parameters

int $code The error code
string $msg The translation string of the message to be sent

Return Value

null

at line 227
public string generate_filter_string(service $cache, string $forum_id)

Looks at the list of allowed extensions and generates a string appropriate for use in configuring plupload with

Parameters

service $cache
string $forum_id The ID of the forum

Return Value

string

at line 263
public string generate_resize_string()

Generates a string that is used to tell plupload to automatically resize files before uploading them.

Return Value

string

at line 284
public int get_chunk_size()

Checks various php.ini values and the maximum file size to determine the maximum size chunks a file can be split up into for upload

Return Value

int

at line 397
public null set_upload_directories(string $upload_directory, string $temporary_directory)

Sets the upload directories to the specified paths

Parameters

string $upload_directory Upload directory
string $temporary_directory Temporary directory

Return Value

null