So any files that are uploaded through my form are getting the following mode:
-rw-------
I need them to have:
-rw-r--r--
I've tried setting the umask in a script file called set_umask.rb as follows:
File.umask(022)
and then starting mongrel using:
mongrel_rails start -m config/mime.types -S set_umask.rb
but it doesn't seem to change the mode that the files are created
with.. I've also tried putting "File.umask(022)' inside
environment.rb but that doesn't make a difference.
To handle uploads, I have a resource model which does the following in
the before_create filter:
def before_create
return FileUtils.copy( @uploaded_file.local_path,
self.path_to_file) if @uploaded_file.instance_of?(Tempfile)
# else
File.open(self.path_to_file, "w") { |f| f.write(@uploaded_file.read) }
end
If anyone has any other hints for how to change the umask, please let
me know, this is driving me crazy! Thanks,
Mike
_______________________________________________
Mongrel-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/mongrel-users