system/helpers/upload.php
Class: upload_Core
class upload_Core
Upload helper class for working with the global $_FILES array and Validation library.
Methods
- upload_Core :: save
- upload_Core :: valid
- upload_Core :: required
- upload_Core :: type
- upload_Core :: size
upload_Core :: save
public static function save
Save an uploaded file to a new location.
Parameters:
- mixed file
- name of $_FILE input or array of upload data
- string filename
- (NULL) new filename
- string directory
- (NULL) new directory
- integer chmod
- (int 420) chmod mask
Return: string full path to new file
upload_Core :: valid
public static function valid
Tests if input data is valid file type, even if no upload is present.
Parameters:
- array file
- $_FILES item
Return: bool
upload_Core :: required
public static function required
Tests if input data has valid upload data.
Parameters:
- array file
- $_FILES item
Return: bool
upload_Core :: type
public static function type
Validation rule to test if an uploaded file is allowed by extension.
Parameters:
- array file
- $_FILES item
- array allowed_types
- allowed file extensions
Return: bool
upload_Core :: size
public static function size
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 file
- $_FILES item
- array size
- maximum file size
Return: bool