Our eyes see things upside down and back to front. We use our brains to turn them 'the right way up'.
The eye and a pinhole camera work the same way. Light travels in straight lines. So the light from the bottom of the object goes through the pupil in the lens in our eye and shines on the top of the back of the eye.
Similarly, the light rays from the top of an object go through the pupil and shine on the bottom of the back of the eye.