Vayeishev - Shishi
...and Then For the Worse.
Mrs. Potifar couldn't leave things well enough alone. She was attracted to the handsome youth and decided to break her husband's one rule. Yoseif resisted the advances of his mistress, saying that he could never betray Potifar, who had placed so much trust in him.
Mrs. Potifar would not relent, so Yoseif started to avoid her. One day, when no one else was in the house, Mrs. Potifar threw herself at him. Yoseif ran away, but she had grabbed onto his garment, which remained in her hand. Mrs. Potifar had had enough and she decided that if she couldn't have Yoseif, she was going to teach him a lesson. She claimed that he had been harassing her and that he ran away when she called for help, leaving his garment behind.
Potifar had reason to doubt her veracity - after all, he knew both his wife and Yoseif pretty well - but under the circumstances, his hands were tied. Yoseif was tossed in prison. (Don't kid yourself - if an Egyptian official really believed that a slave had tried to rape his wife, that servant would have been executed! The punishment reflected Potifar's doubts.)
Yoseif's superior character set him apart even in prison, where he became assistant to the warden. Yes, he was still technically a prisoner himself, but he had responsibilities and was relied upon to carry out many duties. Yoseif's success was thanks to G-d.