In literal terms, it is the act of defecating against the current of a body of water because the circumstances of the situation offer the individual no other option but to poop right then and there in the river. This messy situation, having to poop while submerged in water, is exacerbated by the poor choice of the individual to defecate with his/her backside facing upstream. The current then pushes the feces back in the direction of the defecator and thus makes this already messy situation much messier. In an everyday scenario, this expression means to attempt to improve a desperate situation but in doing so, make the situation worse for oneself.
Example:

Dude 1: How’d it go with Kelly last night? You finally get to bone her before you left for school?
Dude 2: No, I made it worse.
Dude 1: How?
Dude 2: Got myself into the friend zone. I heard she was more into sensitive guys so I tried really hard to be sensitive around her. She ended up telling me I'm a really good person and we should just be friends. I was shitting upstream, man. Now there’s no chance we’re gonna bone, even when we come home for winter vacation.
by PTouch August 21, 2009
Get the shitting upstream mug.