As far as I know, you have to set the permissions on the directory you wish to copy the uploaded file to to at least 766. Having read the PHP documentation, it even says "
remember to do a chmod -c -v 0777 on the directory you want your uploaded files to be moved to."
Please someone correct me if I'm wrong! Perhaps you could set the directory's permissions to 777, then remove permissions one at a time (starting with public execute, then group execute, then public write, etc...) until the script breaks to avoid 'security headaches'.
You could always have a look at
this, which may save you re-inventing the wheel.