Extended file upload form control with some automatic file and error handling.
Extended file upload form control with some automatic file and error handling.
static make_unique($path, $filename, $max=99) [static] ¶Returns a filename which is unique in the given path.
FIXME: might not be the proper place for this function.
$pathThe path where to check the file.
$filenameThe base filename.
$maxThe maximum number of iterations to try. Defaults to 99.
If the file doesn't already exist, it will return $filename, otherwise it will return basename.N.ext where N is the lowest value for which the a filename doesn't exist yet.
Will return false if N were to grow larger than $max.
__construct($name, $uploaddir) ¶Create a new file upload control.
$nameThe name of this control.
$uploaddirThe directory to upload the files to.
build_widget() ¶Render the minimal HTML needed for this control to work.
Form control implementations should implement this method, e.g. for a checkbox a simple input HTML element should be returned.
XHTML element with the minimal HTML markup needed for this control to function properly.
get_fileinfo() ¶Returns information about the upload.
This will be the contents of $_FILES[$control_name] or null if that does not exist.
get_filename() ¶Returns the name of the file uploaded by the user.
is_valid() ¶Check whether this form control is valid.
The default is to apply all validators added to this control. Subclasses could also override this method to do something more sensible than applying validators, since some controls don't accept validators, e.g. checkboxes.
True if valid, false otherwise.
AnewtContainer::_to_array()AnewtContainer::_add()AnewtContainer::delete()AnewtContainer::get()AnewtContainer::_isset()AnewtContainer::_seed()AnewtContainer::setdefault()AnewtContainer::getdefault()AnewtContainer::set()AnewtContainer::__isset()AnewtContainer::__set()AnewtContainer::is_set()AnewtContainer::add()AnewtContainer::_getdefault()AnewtContainer::__unset()AnewtContainer::seed()AnewtContainer::to_array()AnewtContainer::_get()AnewtContainer::__get()AnewtContainer::keys()AnewtContainer::clear()AnewtContainer::_keys()AnewtContainer::_set()AnewtFormControl::$_validator_errorsAnewtFormControl::get_id()AnewtFormControl::add_validator()AnewtFormControl::is_empty()AnewtFormControl::__construct()AnewtFormControl::$_validatorsAnewtFormControl::$_form