Docs For Class FEFile

## Class FEFile

Description

This is the FileUpload FormElement which builds a input field of type="file". This automagically handles the case of a confirmation page.

- copyright: LGPL - See LICENCE
- author: Dave Brondsema <dave@brondsema.net>

Located in /form/form_elements/FEFile.inc (line 27)

    FormElement
       |
       --FEText
          |
          --FEFile

Variable Summary
mixed $_files_info
mixed $_max_size
mixed $_temp_dir
mixed $_valid_types
Method Summary
void add_valid_type (string $mime_type)
INPUTtag get_confirm_element ()
object get_element ()
array get_file_info ()
integer get_max_size (mixed $max_size)
string get_pre_confirm_value ()
string get_temp_dir ()
mixed get_value ()
string get_value_text (mixed 0)
void set_max_size (integer $max_size)
void set_temp_dir (string $dir)
void validate (FormValidation &$_FormValidation)
void _populate_file_info ()
void _pre_confirm ()
Variables
mixed $_files_info = array('name' => '',
'type' => '',
'size' => '',
'tmp_name' => '') (line 34)

The $_FILES information about the submitted file.

mixed $_max_size (line 55)

max size in bytes determined by user

mixed $_temp_dir = "/tmp" (line 43)

The place where we temporarily save

the file during confirmation

mixed $_valid_types = array() (line 49)

Array listing mime types to check for

during validation

#### Inherited Variables

Inherited from FormElement

> FormElement::$onBlurJS
> FormElement::$onChangeJS
> FormElement::$onClickJS
> FormElement::$onFocusJS
> FormElement::$onSubmitJS
> FormElement::$_attributes
> FormElement::$_element_name
> FormElement::$_errors
> FormElement::$_error_message
> FormElement::$_form_name
> FormElement::$_has_error
> FormElement::$_has_form_on_submit
> FormElement::$_is_disabled
> FormElement::$_is_readonly
> FormElement::$_is_required
> FormElement::$_label_colon_flag
> FormElement::$_label_text
> FormElement::$_required_field_marker
> FormElement::$_slave_elements
> FormElement::$_stripslashes
> FormElement::$_style_attributes
> FormElement::$_validation_enabled
> FormElement::$_value

Methods
add_valid_type (line 303)

This is so the user can create a list of mime types to allow

void add_valid_type (string $mime_type)

- string $mime_type: a mime type to check for

get_confirm_element (line 292)

This method returns the hidden version of this element for a confirmation page.

NOTE: This is called by the FormProcessor only. It shouldn't be called manually.

- return: of type hidden

INPUTtag get_confirm_element ()

Redefinition of:

FormElement::get_confirm_element()
  This method returns the hidden version of this element for a confirmation page.

get_element (line 63)

This function builds and returns the form element object

object get_element ()

Redefinition of:

FEText::get_element()
  This function builds and returns the form element object

get_file_info (line 214)

This function will return this file's portion of the $_FILES array

array get_file_info ()
get_max_size (line 322)

This allows the user to get the max size of the file (if any has been set)

- return: value of $_max_size if any

integer get_max_size (mixed $max_size)
get_pre_confirm_value (line 203)

This is so we can save the file information in a hidden form field during confirmation page.

string get_pre_confirm_value ()
get_temp_dir (line 236)

This is so the user can get the temp directory where the file was saved during confirmation (if any)

- return: the new temp dir.

string get_temp_dir ()
get_value (line 164)

This function will return the elements value

mixed get_value ()

Redefinition of:

FormElement::get_value()
  This function will return the elements value

get_value_text (line 186)

- return: - the text associated

string get_value_text (mixed 0)

- mixed 0: - the value to look up

Redefinition of:

FormElement::get_value_text()
  This provides a method

set_max_size (line 312)

This allows the user to set the max size of the file

void set_max_size (integer $max_size)

- integer $max_size: max size in bytes

set_temp_dir (line 225)

This is so the user can set the temp directory where the file will be saved during confirmation (if any)

void set_temp_dir (string $dir)

- string $dir: the new temp dir.

validate (line 82)

This method validates the data for this Form Element.

It validates file size and partial uploads..

void validate (FormValidation &$_FormValidation)

- FormValidation &$_FormValidation: object.

Redefinition of:

FormElement::validate()
  This function performs the actual validation It is called only if the validation is required by this element

_populate_file_info (line 276)

This method re-populates the $this->_files_info because the form had a confirmation page, and the user accepted the confirmation.

This is so we can re populate the local private var so we can get access at the file data on disk.

void _populate_file_info ()
_pre_confirm (line 250)

The function that allows us to save the temp file someplace we can use it after a confirmation has been accepted.

NOTE: if the user doesn't confirm, then this could leave files in /tmp

void _pre_confirm ()

#### Inherited Methods

Inherited From FEText

> FEText::FEText()
> FEText::get_element()

Inherited From FormElement

> FormElement::FormElement()
> FormElement::build_id_name()
> FormElement::create_element_name()
> FormElement::enable_validation()
> FormElement::form_tag_onsubmit()
> FormElement::get_attribute()
> FormElement::get_confirm_element()
> FormElement::get_element()
> FormElement::get_element_name()
> FormElement::get_errors()
> FormElement::get_error_message()
> FormElement::get_form_element()
> FormElement::get_init_value()
> FormElement::get_label()
> FormElement::get_label_text()
> FormElement::get_required_symbol()
> FormElement::get_slave_elements()
> FormElement::get_tabindex()
> FormElement::get_value()
> FormElement::get_value_text()
> FormElement::has_error()
> FormElement::is_disabled()
> FormElement::is_readonly()
> FormElement::is_required()
> FormElement::javascript()
> FormElement::onBlur()
> FormElement::onChange()
> FormElement::onClick()
> FormElement::onFocus()
> FormElement::onSubmit()
> FormElement::set_attribute()
> FormElement::set_colon_flag()
> FormElement::set_data_all_slaves()
> FormElement::set_disabled()
> FormElement::set_element_name()
> FormElement::set_error_message()
> FormElement::set_form_name()
> FormElement::set_label_text()
> FormElement::set_onBlur()
> FormElement::set_onChange()
> FormElement::set_onClick()
> FormElement::set_onFocus()
> FormElement::set_onSubmit()
> FormElement::set_readonly()
> FormElement::set_required()
> FormElement::set_required_symbol()
> FormElement::set_slave_data()
> FormElement::set_slave_elements()
> FormElement::set_stripslashes()
> FormElement::set_style_attribute()
> FormElement::set_tabindex()
> FormElement::set_title()
> FormElement::set_value()
> FormElement::validate()
> FormElement::_build_element_attributes()
> FormElement::_build_javascript()
> FormElement::_do_validation()
> FormElement::_sanitize_string()

Documentation generated on Thu, 1 Sep 2005 17:05:41 -0700 by phpDocumentor 1.3.0RC3