My rule input is of type document of CDT to upload excel file into the database.
Discussion posts and replies are publicly visible
There is a dirty way of achieving it. People in the community do not recommend it but I have been using it for quite a long but in a way that if it ever stops working, I can just change the logic in the single expression rule to avoid errors.
tostring( a!fileUploadField(value: ri!doc).contents.value.filename )
For this to work, just create this in an expression rule and create the 'doc' ri should be of type document.
BTW, if this is helpful to you, you can also use the same rule in the Content Tools plug-in to craft an expression rule that looks at a Doc Id and tells you whether or not it's newly-uploaded. I've found this highly useful in on-form logic determining whether certain buttons or links are enabled, in efforts to reduce cluttering the filesystem with orphaned documents.