Sayyiduna Anas (may Allah be pleased with him) narrates that the Messenger of Allah (peace and blessings be upon him) saw phlegm on the qiblah side of the mosque and disliked it, and signs of displeasure could be recognised on his face (peace and blessings be upon him). Then he (peace and blessings be upon him) scraped it off and said: "When any one of you stands in prayer, he is speaking privately with his Lord," or he said: "Allah is between him and the qiblah, so let him spit to his left or under his foot." Then he (peace and blessings be upon him) took an edge of his garment, spat into it and rubbed it, then said: "Or let him do like this."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 3594