Beispiel #1
0
function form_file_upload_handle($file_data, $field_config)
{
    /**
     * File validations with DB Table Config directives
     */
    $file_max_size = $field_config['file-max-size'] + 0;
    $file_type = $field_config['file-type'];
    if (strstr($file_data['type'], $file_type) === FALSE) {
        return "The file type is {$file_data['type']} not {$file_type}";
    }
    if ($file_data['size'] > $file_max_size) {
        return "Size is bigger than " . $file_max_size / 1024 . "k";
    }
    /**
     * ALL ok? then place the file and let it go... let it goooo! (my daughter Allison fault! <3 )
     */
    if (file_uploads::place_upload_file($file_data['tmp_name'], $file_data['name'])) {
        return TRUE;
    } else {
        return file_uploads::get_last_error();
    }
    //    $file_location = file_uploads::get_uploaded_file_path($file_data['name']);
    //    $file_location_url = file_uploads::get_uploaded_file_url($file_data['name']);
}