upload
class upload
File upload class Init class (all parameters optional and able to be set/overwritten separately) - scope is global and valid for all uploads
Properties
array | $allowed_extensions | ||
protected array | $disallowed_content | ||
int | $max_filesize | ||
int | $min_width | ||
int | $min_height | ||
int | $max_width | ||
int | $max_height | ||
string | $error_prefix | ||
int | $upload_timeout | ||
protected filesystem_interface | $filesystem | ||
protected factory | $factory | ||
protected IniGetWrapper | $php_ini | ||
protected language | $language | ||
protected request_interface | $request |
Methods
Init file upload class.
Reset vars
Set allowed extensions
Set allowed dimensions
Set maximum allowed file size
Set disallowed strings
Set error prefix
Handle upload based on type
Assign internal error
Check if form upload is valid
Get image type/extension mapping
Details
at line 77
__construct(filesystem_interface $filesystem, factory $factory, language $language, IniGetWrapper $php_ini, request_interface $request)
Init file upload class.
at line 89
reset_vars()
Reset vars
at line 105
upload
set_allowed_extensions(array $allowed_extensions)
Set allowed extensions
at line 125
upload
set_allowed_dimensions(int $min_width, int $min_height, int $max_width, int $max_height)
Set allowed dimensions
at line 142
upload
set_max_filesize(int $max_filesize)
Set maximum allowed file size
at line 159
upload
set_disallowed_content(array $disallowed_content)
Set disallowed strings
at line 176
upload
set_error_prefix(string $error_prefix)
Set error prefix
at line 191
filespec|bool
handle_upload(string $type)
Handle upload based on type
at line 209
string
assign_internal_error(string $errorcode)
Assign internal error
at line 264
common_checks(filespec $file)
Perform common file checks
at line 300
bool
valid_extension(filespec $file)
Check for allowed extension
at line 313
bool
valid_dimensions(filespec $file)
Check for allowed dimension
at line 338
bool
is_valid(string $form_name)
Check if form upload is valid
at line 353
bool
valid_content(filespec $file)
Check for bad content (IE mime-sniffing)
at line 363
static array
image_types()
Get image type/extension mapping