abstract class vB_Upload_Abstract

Abstracted class that handles POST data from $_FILES

Properties

array $error Any errors that were encountered during the upload or verification process
vB_Registry $registry Main registry object
vB_Image $image Image object for verifying and resizing
vB_DataManager $upload Object for save/delete operations
array $data Information about the upload that we are working with
array $imginfo Width and Height up Uploaded Image
int $maxuploadsize Maximum size of uploaded file. Set to zero to not check
int $maxwidth Maximum pixel width of uploaded image. Set to zero to not check
int $maxheight Maximum pixel height of uploaded image. Set to zero to not check
array $userinfo Information about user who owns the image being uploaded. Mostly we care about $userinfo['userid'] and $userinfo['attachmentpermissions']
bool $emptyfile Whether to display an error message if the upload forum is sent in empty or invalid (false = Multiple Upload Forms)
boolean $allowanimation Whether or not animated GIFs are allowed to be uploaded

Methods

__construct($registry)

No description

set_warning()

Set warning

set_error()

Set error state and removes any uploaded file

fetch_error()

Returns the current error

accept_upload(mixed $upload)

This function accepts a file via URL or from $_FILES, verifies it, and places it in a temporary location for processing

fetch_remote_filesize(string $url)

Requests headers of remote file to retrieve size without downloading the file

fetch_best_resize(bool $jpegconvert, bool $resize = true)

Attempt to resize file if the filesize is too large after an initial resize to max dimensions or the file is already within max dimensions but the filesize is too large

process_upload()

Verifies a valid remote url for retrieval or verifies a valid uploaded file

save_upload()

Saves a file that has been verified

bool
is_valid_extension(string $extension)

Public Checks if supplied extension can be used

integer
fetch_max_uploadsize(string $extension)

Public Returns the maximum filesize for the specified extension

string
ncrencode_filename($filename)

Public NCR encodes a unicode filename

Details

at line 111
__construct($registry)

Parameters

$registry

at line 126
set_warning()

Set warning

at line 141
set_error()

Set error state and removes any uploaded file

at line 157
fetch_error()

Returns the current error

at line 167
accept_upload(mixed $upload)

This function accepts a file via URL or from $_FILES, verifies it, and places it in a temporary location for processing

Parameters

mixed $upload Valid options are: (a) a URL to a file to retrieve or (b) a pointer to a file in the $_FILES array

at line 383
fetch_remote_filesize(string $url)

Requests headers of remote file to retrieve size without downloading the file

Parameters

string $url URL of remote file to retrieve size from

at line 422
fetch_best_resize(bool $jpegconvert, bool $resize = true)

Attempt to resize file if the filesize is too large after an initial resize to max dimensions or the file is already within max dimensions but the filesize is too large

Parameters

bool $jpegconvert Has the image already been resized once?
bool $resize Attempt a resize

at line 555
process_upload()

Verifies a valid remote url for retrieval or verifies a valid uploaded file

at line 561
save_upload()

Saves a file that has been verified

at line 571
bool is_valid_extension(string $extension)

Public Checks if supplied extension can be used

Parameters

string $extension Extension of file

Return Value

bool

at line 582
integer fetch_max_uploadsize(string $extension)

Public Returns the maximum filesize for the specified extension

Parameters

string $extension Extension of file

Return Value

integer

at line 590
string ncrencode_filename($filename)

Public NCR encodes a unicode filename

Parameters

$filename

Return Value

string