I've found this to be quite useful in handing uploaded files through HTTP. You can use this to move the file from your /tmp folder to a folder on your site that isn't mode 777. The concept is simple.
This is a public code snippet repository. Share your snippets with other developers to gain valuable feedback. Tag your snippets with keywords to make them easy to find.