Abdullah bin Umar reported,

The Prophet ﷺ saw some phlegm on the wall of the mosque facing the qiblah and became angry with the people of the mosque. He said, "Allah is in front of one of you, so when any of you is in his prayer, let him not spit," or he said, "let him not expel phlegm." Then he came down and scraped it off with his hand.Ibn Umar رضي الله عنهم said, "When any of you needs to spit, let him spit to his left."

Bukhari 1213

Sahih

حدثنا سليمان بن حرب حدثنا حماد عن أيوب عن نافع

عن ابن عمر رضي الله عنهما

أن النبي ﷺ رأى نخامة في قبلة المسجد فتغيظ على أهل المسجد وقال إن الله قبل أحدكم فإذا كان في صلاته فلا يبزقن أو قال لا يتنخمن ثم نزل فحتها بيده وقال ابن عمر رضي الله عنهما إذا بزق أحدكم فليبزق على يساره

البخاري 1213صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Bukhari
Book
Work during prayer
Chapter
What is permissible of spitting and blowing during prayer
Numbering
Darussalam 1213
Bukhari 1213