Hi!
On Tue, Sep 05, 2006 at 05:32:41PM -0400, Mike Garey wrote:
> 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.
I've had similar problems, in my case the umask I set was used when
uploading from Firefox/linux, but not when uploading from
Firefox/windows. Weird, but manually changing the permissions after
copying the file finally fixed this.
File.chmod(0644, self.path_to_file)
after the File.open line should do the trick for you.
Jens
>
> 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
--
webit! Gesellschaft für neue Medien mbH www.webit.de
Dipl.-Wirtschaftsingenieur Jens Krämer [EMAIL PROTECTED]
Schnorrstraße 76 Tel +49 351 46766 0
D-01069 Dresden Fax +49 351 46766 66
_______________________________________________
Mongrel-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/mongrel-users