PHP Image Upload Script

I need help. Now this script generates a random Name. What do I modify to make it use the original file name. I am very new to coding and PHP. Also it seems to drop the
"period" before the extension. So i have to manual add it back so it opens as an image.