Public Member Functions | Data Fields
FileUpload Class Reference

Html form file upload manager. More...

Inheritance diagram for FileUpload:
Dispersion

Public Member Functions

 FileUPload ()
 
 restrictSize ($min=null, $max=null)
 
 restrictType ($type)
 
 requiredFiles ($file=array())
 
 checkFile ($filename)
 
 moveTo ($location, $filename=null)
 
- Public Member Functions inherited from Dispersion
 Dispersion ()
 
 emptyLayout ()
 
 set ($name, $value)
 
 _set ($name, $value)
 
 insertView ($name, $index=-1)
 

Data Fields

const INI_MAX_SIZE = 0
 
const FORM_MAX_SIZE = 1
 
const INCOMPLETE = 2
 
const REQUIRED = 3
 
const MAX_SIZE = 4
 
const MIN_SIZE = 5
 
const TYPE = 6
 
const UNKNOWN = 7
 
 $restrict_size_max
 
 $restrict_size_min
 
 $restrict_type
 
 $required_files
 
 $upload_success = array()
 
- Data Fields inherited from Dispersion
 $model_ob = null
 
 $debug_ob = null
 
 $_variables = array()
 
 $_content = array()
 
 $_content_count = 0
 
 $model
 
 $debug
 

Additional Inherited Members

- Protected Member Functions inherited from Dispersion
 requireConfigFile ($file_name, $required=false)
 

Detailed Description

Html form file upload manager.

Version
1.2
Author
DinuSV

Member Function Documentation

FileUPload ( )

Constructor

restrictSize (   $min = null,
  $max = null 
)

Restrict file size in bytes

Parameters
int$min
int$max
restrictType (   $type)

Restrict file type

Parameters
$typestring/array : type of files allowed
requiredFiles (   $file = array())

Files that are required for upload

Parameters
string-array$file: file names that are required
Returns
current object
checkFile (   $filename)

Checks if the file returned any errors upon uploading, and checks if the file matches the restrictions

Parameters
string$filename: the filename to be checked
Returns
boolean : true if the file is valid and uploaded, false otherwise
Exceptions
UploadFileException
IncompleteActionException
InvalidFileTypeException
EmptyFieldException
moveTo (   $location,
  $filename = null 
)

Move uploaded file(s)

Parameters
string$location: the location to upload the file
null$filename: all the files will be uploaded array $filename : key => name of the field, value => name of the uploaded file
Exceptions
UploadFileException

Field Documentation

const INI_MAX_SIZE = 0

Maximum size defined by ini file error

const FORM_MAX_SIZE = 1

Maximum size defined by form error

const INCOMPLETE = 2

Incomplete / Interrupted upload

const REQUIRED = 3

File required, yet field was empty

const MAX_SIZE = 4

File exceeds the set maximum size

const MIN_SIZE = 5

File is smaller than the set minimum size

const TYPE = 6

Invalid file type

const UNKNOWN = 7

Unknown upload file problem

$restrict_size_max

int : Restrict maximum size of uploaded files in bytes

$restrict_size_min

int : Restrict minimum size of uploaded files in bytes

$restrict_type

array : Restrict allowed types of uploaded files

$required_files

array : Add required fields

$upload_success = array()

array : Files that have been uploaded succesfully