File.chown

I have written a helper to upload a file using the http protocol. It's only two lines long; and, for the most part, it works just fine. However, when the uploaded file is written, it has root as the owner and group. I would really like it to have a different owner and group. It would seem that that would be almost trivial. Since the uploaded file is written with root as the owner and group, I concluded that my helper method must be running as root. So, I thought I would just add a third line of code to my helper which would call File.chown to change the ownership and group on the uploaded file. It doesn't seem to work. No complaints anywhere, it just doesn't work. Can anyone suggest what I might do to get this to work, i.e., to change the ownership and group on the uploaded file? Here's my helper method:

def httpUpload(file2upload,saveAs)     directoryPath='/tmp/'                 File.open(directoryPath+saveAs,'wb'){|f| f.write(file2upload.read)}     File.chown(500,100,directoryPath+saveAs)   end

Thanks for any input.

     ... doug