Awhile ago there was some discussion on #php , this use was proposed (by onki) :
$tmp_name = $HTTP_POST_FILES['userfile']['tmp_name'];
move_uploaded_file ($tmp_name, '/home/httpd/html/upload/example.zip');
chmod('/home/httpd/html/upload/example.zip', 0644);
And it works. move_uploaded_file() is the key here. Haven't personally tried it as the safe mode server I have access to is 4.0.2 and move_uploaded_file is a 4.0.3 function.
What I did was get a script called chuid from here :
http://www.srparish.net/scripts/
It must be installed by sysadmin. Then, users do something like this :
... <input type="file" name="file"> ...
passthru ("chuid $file 1033");
@copy($file, "/path/to/uploads/$file_name")
or die ("could not copy file $file_name");
Something like that. The above (1033) is the users uid which of course is different for everyone. It can be echo'd in shell like this :
echo $UID
But that's more complicated :-)