There is field "name" in document entity. When user uploads the document with same name, the old document is getting replaced/rewritten. But, the requirement now is to add a new Javascript to the function so that whenever document is same name is uploaded, it should throw an alert.