phpBB API Documentation
Class

fileupload

class fileupload

File upload class Init class (all parameters optional and able to be set/overwritten separately) - scope is global and valid for all uploads

Properties

$allowed_extensions
$disallowed_content
$max_filesize
$min_width
$min_height
$max_width
$max_height
$error_prefix
int $upload_timeout

Methods

fileupload($error_prefix = '', $allowed_extensions = false, $max_filesize = false, $min_width = false, $min_height = false, $max_width = false, $max_height = false, $disallowed_content = false)

Init file upload class.

reset_vars()

Reset vars

set_allowed_extensions($allowed_extensions)

Set allowed extensions

set_allowed_dimensions($min_width, $min_height, $max_width, $max_height)

Set allowed dimensions

set_max_filesize($max_filesize)

Set maximum allowed filesize

set_disallowed_content($disallowed_content)

Set disallowed strings

set_error_prefix($error_prefix)

Set error prefix

object form_upload(string $form_name)

Form upload method Upload file from users harddisk

local_upload($source_file, $filedata = false)

Move file from another location to phpBB

object remote_upload(string $upload_url)

Remote upload method Uploads file from given url

assign_internal_error($errorcode)

Assign internal error

common_checks($file)

Perform common checks

valid_extension($file)

Check for allowed extension

valid_dimensions($file)

Check for allowed dimension

is_valid($form_name)

Check if form upload is valid

valid_content($file)

Check for allowed extension

image_types()

Return image type/extension mapping

Details

at line 484
public fileupload($error_prefix = '', $allowed_extensions = false, $max_filesize = false, $min_width = false, $min_height = false, $max_width = false, $max_height = false, $disallowed_content = false)

Init file upload class.

Parameters

$error_prefix
$allowed_extensions
$max_filesize
$min_width
$min_height
$max_width
$max_height
$disallowed_content

at line 496
public reset_vars()

Reset vars

at line 508
public set_allowed_extensions($allowed_extensions)

Set allowed extensions

Parameters

$allowed_extensions

at line 519
public set_allowed_dimensions($min_width, $min_height, $max_width, $max_height)

Set allowed dimensions

Parameters

$min_width
$min_height
$max_width
$max_height

at line 530
public set_max_filesize($max_filesize)

Set maximum allowed filesize

Parameters

$max_filesize

at line 541
public set_disallowed_content($disallowed_content)

Set disallowed strings

Parameters

$disallowed_content

at line 552
public set_error_prefix($error_prefix)

Set error prefix

Parameters

$error_prefix

at line 565
public object form_upload(string $form_name)

Form upload method Upload file from users harddisk

Parameters

string $form_name Form name assigned to the file input field (if it is an array, the key has to be specified)

Return Value

object $file Object "filespec" is returned, all further operations can be done with this object

at line 630
public local_upload($source_file, $filedata = false)

Move file from another location to phpBB

Parameters

$source_file
$filedata

at line 722
public object remote_upload(string $upload_url)

Remote upload method Uploads file from given url

Parameters

string $upload_url URL pointing to file to upload, for example http://www.foobar.com/example.gif

Return Value

object $file Object "filespec" is returned, all further operations can be done with this object

at line 911
public assign_internal_error($errorcode)

Assign internal error

Parameters

$errorcode

at line 961
public common_checks($file)

Perform common checks

Parameters

$file

at line 995
public valid_extension($file)

Check for allowed extension

Parameters

$file

at line 1003
public valid_dimensions($file)

Check for allowed dimension

Parameters

$file

at line 1024
public is_valid($form_name)

Check if form upload is valid

Parameters

$form_name

at line 1033
public valid_content($file)

Check for allowed extension

Parameters

$file

at line 1041
public image_types()

Return image type/extension mapping