Ваша функция формы
// don't forget this line
$form['#attributes'] = array('enctype' => "multipart/form-data");
$form['container']['csv_file'] = array(
'#type' => 'file' ,
'#title' => t('csv FILE') ,
'#description' => t('insert your csv file here') ,
) ;
Ваша функция проверки
function _your_function_validate($form, $form_state) {
$extensions = 'csv' ;
$validators = array(
'file_validate_extensions' => array($extensions),
);
// if the file not uploaded or the extension is wrong set error
if(!file_save_upload('csv_file', $validators)) { // cvs_file is the form name
form_set_error('csv_file', 'Please select the csv file') ;
}else{
// now the form is uploaded lets make another validation for extension
$file = file_save_upload('csv_file', $validators, file_directory_path()) ;
// another validator for the extension
if($file->filemime != 'text/csv' ) {
form_set_error('csv_file', 'Extensions Allowed : csv') ;
}
}
}