Narrated Anas bin Malik
The Prophet (ﷺ) saw some sputum in the direction of the Qibla (on the wall of the mosque) and he disliked that and the sign of disgust was apparent from his face. So he got up and scraped it off with his hand and said, "Whenever anyone of you stands for the prayer, he is speaking in private to his Lord or his Lord is between him and his Qibla. So, none of you should spit in the direction of the Qibla but one can spit to the left or under his foot." The Prophet (ﷺ) then took the corner of his sheet and spat in it and folded it and said, "Or you can do this. "
Narrated `Abdullah bin `Umar
Allah's Messenger (ﷺ) saw sputum on the wall of the mosque in the direction of the Qibla and scraped it off. He faced the people and said, "Whenever any one of you is praying, he should not spit in front of him because in the prayer Allah is in front of him."
Narrated `Aisha
(the mother of faithful believers) Allah's Messenger (ﷺ) saw some nasal secretions, expectoration or sputum on the wall of the mosque in the direction of the Qibla and scraped it off.