CI_Upload::_prep_filename | ( | $ | filename | ) |
Prep Filename
Prevents possible script execution from Apache's handling of files multiple extensions http://httpd.apache.org/docs/1.3/mod/mod_mime.html#multipleext
private
string |
CI_Upload::CI_Upload | ( | $ | props = array() |
) |
Constructor
public
CI_Upload::clean_file_name | ( | $ | filename | ) |
Clean the file name for security
public
string |
CI_Upload::data | ( | ) |
Finalized Data Array
Returns an associative array containing all of the information related to the upload, allowing the developer easy access in one array.
public
CI_Upload::display_errors | ( | $ | open = '<p>' , |
|
$ | close = '</p>' | |||
) |
Display the error message
public
string | ||
string |
CI_Upload::do_upload | ( | $ | field = 'userfile' |
) |
Perform the file upload
public
CI_Upload::do_xss_clean | ( | ) |
Runs the file through the XSS clean function
This prevents people from embedding malicious code in their files. I'm not sure that it won't negatively affect certain files in unexpected ways, but so far I haven't found that it causes trouble.
public
CI_Upload::get_extension | ( | $ | filename | ) |
Extract the file extension
public
string |
CI_Upload::initialize | ( | $ | config = array() |
) |
Initialize preferences
public
array |
CI_Upload::is_allowed_dimensions | ( | ) |
Verify that the image is within the allowed width/height
public
CI_Upload::is_allowed_filesize | ( | ) |
Verify that the file is within the allowed size
public
CI_Upload::is_allowed_filetype | ( | ) |
Verify that the filetype is allowed
public
CI_Upload::is_image | ( | ) |
Validate the image
public
CI_Upload::limit_filename_length | ( | $ | filename, | |
$ | length | |||
) |
Limit the File Name Length
public
string |
CI_Upload::mimes_types | ( | $ | mime | ) |
List of Mime Types
This is a list of mime types. We use it to validate the "allowed types" set by the developer
public
string |
CI_Upload::set_allowed_types | ( | $ | types | ) |
Set Allowed File Types
public
string |
CI_Upload::set_error | ( | $ | msg | ) |
Set an error message
public
string |
CI_Upload::set_filename | ( | $ | path, | |
$ | filename | |||
) |
Set the file name
This function takes a filename/path as input and looks for the existence of a file with the same name. If found, it will append a number to the end of the filename to avoid overwriting a pre-existing file.
public
string | ||
string |
CI_Upload::set_image_properties | ( | $ | path = '' |
) |
Set Image Properties
Uses GD to determine the width/height/type of image
public
string |
CI_Upload::set_max_filename | ( | $ | n | ) |
Set Maximum File Name Length
public
integer |
CI_Upload::set_max_filesize | ( | $ | n | ) |
Set Maximum File Size
public
integer |
CI_Upload::set_max_height | ( | $ | n | ) |
Set Maximum Image Height
public
integer |
CI_Upload::set_max_width | ( | $ | n | ) |
Set Maximum Image Width
public
integer |
CI_Upload::set_upload_path | ( | $ | path | ) |
Set Upload Path
public
string |
CI_Upload::set_xss_clean | ( | $ | flag = FALSE |
) |
Set XSS Clean
Enables the XSS flag so that the file that was uploaded will be run through the XSS filter.
public
bool |
CI_Upload::validate_upload_path | ( | ) |
Validate Upload Path
Verifies that it is a valid upload path with proper permissions.
public
CI_Upload::$allowed_types = "" |
CI_Upload::$encrypt_name = FALSE |
CI_Upload::$error_msg = array() |
CI_Upload::$file_ext = "" |
CI_Upload::$file_name = "" |
CI_Upload::$file_size = "" |
CI_Upload::$file_temp = "" |
CI_Upload::$file_type = "" |
CI_Upload::$image_height = '' |
CI_Upload::$image_size_str = '' |
CI_Upload::$image_type = '' |
CI_Upload::$image_width = '' |
CI_Upload::$is_image = FALSE |
CI_Upload::$max_filename = 0 |
CI_Upload::$max_height = 0 |
CI_Upload::$max_size = 0 |
CI_Upload::$max_width = 0 |
CI_Upload::$mimes = array() |
CI_Upload::$orig_name = "" |
CI_Upload::$overwrite = FALSE |
CI_Upload::$remove_spaces = TRUE |
CI_Upload::$temp_prefix = "temp_file_" |
CI_Upload::$upload_path = "" |
CI_Upload::$xss_clean = FALSE |