How to find the name of changed file in Forms API I've a file field attached to a node form. I want to know in the submit handler if the file has been replaced then I'll take some action.

For example I delete the previously uploaded file : abc.txt and then upload a new one "newdoc.txt" in place of it and "Submit".

I don't want to  load the node and read it's contents or use hook_presave and read the value using $node->original.
I have just verified it... Form submit handler does store old values and new values..

In $form you see old fid in #node property , In $form_state['values'] you see new fid that was uploaded...




By comparing above two in your submit handler you can take action..

function my_custom_submit_file_alter_detector($form, &amp;$form_state) {
  dpm($form);
  dpm($form_state);
}