class.upload.php is a powerful and mature PHP class to manage uploaded files, and manipulate images in many ways. The script is available under a GPL license.
more info about the class
Also make sure that you set the enctype property of your form tag, as following: enctype="multipart/form-data"
And what do you have in your variable $fileToUpload?