[eluser]TheFuzzy0ne[/eluser]
Code:
function _valid_filesize()
{
if (!$this->audio_model->is_audio($_FILES['userfile']['tmp_name'],'size'))
{
$this->form_validation->set_message('_valid_filesize', 'The audio selection cannot be any longer than 20 minutes.');
return FALSE;
}
return TRUE;
}
Something like the above (although it could still use some tweaking).
Then add it to your rules.
Code:
$rules = array(
'field' => 'audio_file',
'label' => 'Audio File',
'rules' => 'callback__valid_filesize'
);
$this->form_validaton->set_rules($rules);
In order for this to work, you'll probably have to add a hidden form field called "audio_file".
EDIT: In fact, I see two validation attempts that need to be done as callbacks. This will ensure the the validation is all done at once.