Form API file upload field default value implementation using AJAX/AHAH Apologies for the long explanation.  I have a form built using the From API that is used as a profile for users. It allows users to upload a CV/resume type file for themselves and it is mandatory to upload a file or the user cannot complete the form.  

Uploading and saving the files are no problem, but I run into problems when the user tries to update their form.  The file input type in the Form API doesn't have a #default_value option (understandably) which means that when the user comes to edit the form, there are two problems.  

The first is that it shows a blank file upload field and the user is expected to upload a file again (as the field is mandatory).  This is confusing for the user and means that more than one file can be assigned to a user.  The second is that the user does not have an option to remove their file and add a new one to replace it.

What I would like to do is write a function that checks to see if the form is being accessed by a logged in user, checks if that user has a file associated with them and displays the field appropriately.  If a file exists, display the name of the file and a link to remove it instead of showing the file upload field.  

I could do most of this no problem, but the extra part I would like and can't do is for the "Remove file" link to be an AJAX call that would delete the user's file and then display the file upload field dynamically.  Has anyone done something like this before?
Unfortunately, depsite the vast amount of answers posted to this question, there was no easy way to do this.  In the end, I had to check when the form was being displayed if the form already had content, and if so, if the form had a file attached.  I then displayed a different value rather than the form field and made a validation workaround due to the fact that the file upload was mandatory.

My advice to others with similar problems: if you're using this as an user profile field, avoid FAPI and stick to CCK and Content Profile.  Although it can be a pain sometimes, all of this functionality is already taken care of.