FreenetIS
 All Classes Namespaces Functions Variables Pages
Static Public Member Functions | Static Public Attributes | List of all members
upload Class Reference

Static Public Member Functions

static save ($file, $filename=NULL, $directory=NULL, $chmod=0644)
 Save an uploaded file to a new location.
static valid ($file)
 Tests if input data is valid file type, even if no upload is present.
static required (array $file)
 Tests if input data has valid upload data.
static type (array $file, array $allowed_types)
 Validation rule to test if an uploaded file is allowed by extension.
static size (array $file, array $size)
 Validation rule to test if an uploaded file is allowed by file size.

Static Public Attributes

static $mimes

Member Function Documentation

static upload::required ( array  $file)
static

Tests if input data has valid upload data.

Parameters
array$_FILESitem
Returns
bool
static upload::save (   $file,
  $filename = NULL,
  $directory = NULL,
  $chmod = 0644 
)
static

Save an uploaded file to a new location.

Parameters
mixedname of $_FILE input or array of upload data
stringnew filename
stringnew directory
integerchmod mask
Returns
string full path to new file
static upload::size ( array  $file,
array  $size 
)
static

Validation rule to test if an uploaded file is allowed by file size.

File sizes are defined as: SB, where S is the size (1, 15, 300, etc) and B is the byte modifier: (B)ytes, (K)ilobytes, (M)egabytes, (G)igabytes. Eg: to limit the size to 1MB or less, you would use "1M".

Parameters
array$_FILESitem
arraymaximum file size
Returns
bool
static upload::type ( array  $file,
array  $allowed_types 
)
static

Validation rule to test if an uploaded file is allowed by extension.

Parameters
array$_FILESitem
arrayallowed file extensions
Returns
bool
static upload::valid (   $file)
static

Tests if input data is valid file type, even if no upload is present.

Parameters
array$_FILESitem
Returns
bool

The documentation for this class was generated from the following file: