http://uk.php.net/posix_getpwuid will tell you how to read the results of the posix_getpwuid() function
when you write an upload script, the script will run as the user of the webserver that you are using. so if you create a new folder the user and group permissions will be set to that users user and group.
When you manually create a folder it will create them with the user and group of that user
If you want both the webserver and the user to have access, then you should create a group that contains both the manual user(s) and the webserver user in it, then grant permission so that the group on the file is the group you create, then grant 77* permissions to give ther user and the group read, write, execute with world permissions set to what ever you need it to be.