Currently we do something like this:
$validators = array(
'file_validate_extensions' => array('po'),
'file_validate_size' => array(file_upload_max_size()),
);
$form['file'] = array(
'#type' => 'managed_file',
'#title' => t('File'),
'#size' => 50,
'#description' => theme('file_upload_help', array('description' => t('The description of my upload field.'), 'upload_validators' => $validators)),
'#upload_validators' => $validators,
'#required' => TRUE,
);
But it would be nice if the file_upload_help was added automatically and we only had to do:
$validators = array(
'file_validate_extensions' => array('po'),
'file_validate_size' => array(file_upload_max_size()),
);
$form['file'] = array(
'#type' => 'managed_file',
'#title' => t('File'),
'#description' => t('The description of my upload field.'),
'#size' => 50,
'#upload_validators' => $validators,
'#required' => TRUE,
);
Automatically adding the validation description would also easily allow other modules to alter the validators for specific elements without having to re-do the description.