Hi Karthik,
The platform doesn't really know what document you are uploading, or what is a "valid" document... either you have some sort of way to check validity of the document (e.g. a library that has functionality to check the document is not corrupt) that you could use on the Screen Action that handles the upload, or you don't really have much of a choice I believe.
What kind of document is it?