Replacing file when another file is uploaded

Hi , To explain, I upload a file and when I try to upload another file it should replace the previous file(Like it should accept only one file). How to do that?   And here Upload is an action button
1 answers

The file is an object in your database and a file in your filesystem. If you create a new DB object for your file, a second file will be stored. If you reuse the object you already created for file 1, the existing file will be overwritten when uploading a new file.