Run Apache as a user of the system that has write rights to the folder(s) in question. PHP will run as the apache user (unless suPHP is installed, in which case it should run as the site user).
Other than that, you can make sure the temp files are uploaded to a real temp dir that is chmodded to 777 but then you probably wouldn't be able to copy things over to your web directory from there.
There's nothing overly insecure with 777 permissions, if you properly harden your code and server, you should be okay.