The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

You might also want to look for the position of the . then get the extension from there, instead of taking the last 3 characters from the end. For instance, someones image file might have the .jpeg extension.

PHP Code:

$filetyp = substr($uploadfile, -3);

This would return jpe in this case.
I'd use:

PHP Code:

$extension = substr(strtolower(strrchr($filename, ".")), 1);

When you submit a file form, it populates the $_FILES superglobal array. From here you can access all the details you need. It seems you are making a copy of this array ($uploadfile) and passing it to the copy function. Really, you should use the move_upload_file, and pass it the appropriate $_FILE value.