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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---