Sayyiduna Abu Hurayrah (may Allah be pleased with him) narrates: While leading the people in prayer, the Prophet (peace and blessings be upon him) took off his sandals. When the people noticed this, they also took off their sandals. When he finished the prayer, he turned towards the people and said: The angel came to me and informed me that there was filth on my sandals. When any of you comes to the mosque, he should turn his sandals over and look; if he sees anything on them, he should wipe them and then offer prayer in them.
Bazzar and Tabarani recorded it, the latter in al-Mu'jam al-Awsat, with these words: "Then he should offer prayer in them, or take them off if he sees fit." The chain of both contains a narrator, Abbad bin Kathir al-Basri, who settled in Makkah, and he is da'if (weak).
Hadith Referenceمجمع الزوائد ومنبع الفوائد / كتاب الصلاة / 2258