Time dilation $t'=(1-\frac{v}{c})t$ instead of $t'=\frac{1}{\gamma} t$

Suppose we have a train moving. When the origin of train's frame coincides with the origin of observers frame; the the time is set to zero. At that very instant, a photon is emitted from train towards the direction train is moving. After time $t$ measured by observer at rest the photon will be at a distance $ct$ and the train at a distance $vt$; but the photon is at a distance $ct-vt$ from the train, now the time that the passenger on train measures for the photon to reach that point is the distance divided by the velocity of light ( which of course is $c$) so

time measured by observer on train is $t'=\frac{ct-vt}{c}= (1-\frac{v}{c})t$ . where $t$ is time measured by observer at rest.

Where is the mistake in this reasoning?

-
Your mistake is assuming that the distance measured by the two observers will be the same. In special relativity there is both a length contraction and a time dilation. The observer on the train will not agree with the observer on the ground that the length was $ct-vt$. He will think the clock on the ground that measured time t was running slowly. In fact each will think the other clock is running slowly by the same factor of $\sqrt{ 1 - v^2/c^2 }$.
Thank you for your answer. But, Why wouldn't the observer on the train not agree that the distance between him and the photon is $ct-vt$? –  Prakash Gautam Oct 31 '12 at 11:33
@PrakashGautam, the events (1) photon at $ct$ and (2) train at $vt$, while simultaneous in the observer's frame, occur at different times in the train's frame (they are not simultaneous in the train's frame). Look up "relativity of simultaneity". –  Alfred Centauri Oct 31 '12 at 12:52