phpBB API Documentation
Class

fileerror

class fileerror extends filespec

Class for assigning error messages before a real filespec class can be assigned

Properties

$filename
$realname
$uploadname
$mimetype
$extension
$filesize
$width
$height
$image_info
$destination_file
$destination_path
$file_moved
$init_error
$local
$error
$upload

Methods

filespec($upload_ary, $upload_namespace, guesser $mimetype_guesser = null, plupload $plupload = null)

File Class

from filespec
clean_filename(real|unique|unique_ext $mode = 'unique', string $prefix = '', string $user_id = '')

Cleans destination filename

from filespec
get($property)

Get property from file object

from filespec
true is_image()

Check if file is an image (mimetype)

from filespec
true is_uploaded()

Check if the file got correctly uploaded

from filespec
remove()

Remove file

from filespec
static string get_extension(string $filename)

Get file extension

from filespec
string get_mimetype(string $filename)

Get mimetype

from filespec
get_filesize($filename)

Get filesize

from filespec
check_content($disallowed_content)

Check the first 256 bytes for forbidden content

from filespec
move_file(string $destination, bool $overwrite = false, bool $skip_image_check = false, string $chmod = false)

Move file to destination folder The phpbbrootpath variable will be applied to the destination path

from filespec
additional_checks()

Performing additional checks

from filespec
fileerror($error_msg)

Details

in filespec at line 65
public filespec($upload_ary, $upload_namespace, guesser $mimetype_guesser = null, plupload $plupload = null)

File Class

Parameters

$upload_ary
$upload_namespace
guesser $mimetype_guesser
plupload $plupload

in filespec at line 110
public clean_filename(real|unique|unique_ext $mode = 'unique', string $prefix = '', string $user_id = '')

Cleans destination filename

Parameters

real|unique|unique_ext $mode real creates a realname, filtering some characters, lowering every character. Unique creates an unique filename
string $prefix Prefix applied to filename
string $user_id The user_id is only needed for when cleaning a user's avatar

in filespec at line 155
public get($property)

Get property from file object

Parameters

$property

in filespec at line 170
public true is_image()

Check if file is an image (mimetype)

Return Value

true if it is an image, false if not

in filespec at line 180
public true is_uploaded()

Check if the file got correctly uploaded

Return Value

true if it is a valid upload, false if not

in filespec at line 200
public remove()

Remove file

in filespec at line 214
static public string get_extension(string $filename)

Get file extension

Parameters

string $filename Filename that needs to be checked

Return Value

string Extension of the supplied filename

in filespec at line 233
public string get_mimetype(string $filename)

Get mimetype

Parameters

string $filename Filename that needs to be checked

Return Value

string Mimetype of supplied filename

in filespec at line 251
public get_filesize($filename)

Get filesize

Parameters

$filename

in filespec at line 260
public check_content($disallowed_content)

Check the first 256 bytes for forbidden content

Parameters

$disallowed_content

in filespec at line 295
public move_file(string $destination, bool $overwrite = false, bool $skip_image_check = false, string $chmod = false)

Move file to destination folder The phpbbrootpath variable will be applied to the destination path

Parameters

string $destination Destination path, for example $config['avatar_path']
bool $overwrite If set to true, an already existing file will be overwritten
bool $skip_image_check If set to true, the check for the file to be a valid image is skipped
string $chmod Permission mask for chmodding the file after a successful move. The mode entered here reflects the mode defined by {@link phpbb_chmod()}

in filespec at line 439
public additional_checks()

Performing additional checks

at line 480
public fileerror($error_msg)

Parameters

$error_msg