Giving sadaqah openly is like reciting the Quran loudly. This is because if there is a benefit, then it is preferable. Otherwise. it is best he gives sadaqah secretly due to the Hadeeth in which the Prophet Muhammad (alayhi salaatu was-salaam) said,

“The one who recites the Qur’an loudly is like one who gives charity openly, and the one who recites the Qur’an silently is like the one who gives charity in secret.”
Source: an-Nisa’i no. 1663. The Hadeeth has been authenticated by Shaykh Muqbil.

~ Abu Fajr AbdulFattaah bin Uthman