I guess a validator would sort things out in this situation. However, this is a general problem - uploading files that have the same name (test.doc, figures.xls, etc.) - how do you know that its ok to overwrite the file with the same name? If it's just you uploading files, you're probably ok, but if this is to be a shared system, you'll need to be more watchful.
If you're not careful, you'll end up writing a content management system. Cheers, Tone