Try using something along these lines...
You can make changes to the code later.. this is something I use on my site:
For the HTML page with the form:
For the PHP page with the PHP (duh):
And then for the PHP in your image directory try using this (make it index.php):
Of course, you're going to want to throw in some actual HTML around all that code/php so that it doesn't look like shit. I didn't write all that code, I just modified it a bunch. Honestly I can't say who came up with it originally because my friend Davin sent it to me.