To get around the duplicate image name problem, control the image names yourself. You could either a have unique string as the full name, or attach it to the end of the original image, e.g. 1251120114.jpg ... or ... my_picture_2009-1251120114.jpg. A good way to ensure (as good as) a completely unique number is to attach a random number to time.
As for checking the file extension, look around on Google. There's literally millions of tutorials out there for uploading images with PHP, I'm sure with a bit of work you'll be able to implement some of the code used.