How to upload only photos but not any files in to ror applic

i hav been learning this from few days.
I was doing a module on uploading photos.
I reuired to upload photos in to our application and NOTE is only photos
in each and every format like jpeg,gif must upload but not any other
files or folders.
Kindly Send me the exact code as early as possible,then i can do it in a
period.I hope i wil get replies very soon…

Thank u so much inadvance…
Hav a nice time