function test_data_import_form($form, &$form_state) {
$form = array();
//$form['#attributes'] = array('enctype' => 'multipart/form-data');
$form['import_data'] = array(
'#type' => 'file',
'#title' => t('Upload data file'),
'#size' => 22,
'#required' => TRUE,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Submit'),
'#validate' => array('test_data_import_validate'),
'#submit' => array('test_data_import_submit'),
);
return $form;
}
Please see my form code above. I am trying to import a file through this form, but the file I am trying to import is not recognized as it is throwing "Required field error". Please help me with this.