Where is the value in a form textfield stored?
The easiest way to debug form related issues I have found is with the devel module

drush dl devel &amp;&amp; drush en devel -y


This module provides a whole host of helpful functions. E.g. in your case you could use this in your validation function:

dsm($form_state['values']);


This would print a lovely formatted array of every value in the form. From there you can drill down to the required value.

I believe you should be checking for:

if (empty(trim($form_state['values']['field_upload_file']))) {
  form_set_error('upload_file', "Please enter a file name: ");
}


Or alternatively, if you are just checking to see if the textfield simply has a value in it, then the better approach would be to use the FAPI and declare:

$form['upload_file'] = array(
  '#type' =&gt; 'textfield',
  '#title' =&gt; t('File to read'),
  '#required' =&gt; TRUE,
);