New answers tagged custom-actions
Out of the box this is not possible. If you are open to custom development then follow below steps Hide existing download button using custom action Hide context menu option to download file using custom action Create new ribbon button. Now you will have complete control over the click event.
I don't think the custom action can work well with InfoPath forms. You can refer to this similar thread Custom Actions and InfoPath Still you can try steps mentioned in below URL. Add custom commands on Infopath browser form ribbon
Top 50 recent answers are included