[Mongrel] mongrel and uploaded files (temp location)

Kirk Haines wyhaines at gmail.com
Thu Mar 6 15:26:23 EST 2008


On Thu, Mar 6, 2008 at 1:15 PM, Dan Buettner <drbuettner at gmail.com> wrote:

> I'd like to change where mongrel stores files uploaded via web form from the
> local tmp dir to a place on the same filesystem where they will eventually
> reside, due to speed considerations (copying from tmp to NFS mount takes a
> little time while the user wait for the web form to return)
>
> Is there a way to do this do you think?

There's a way to do most anything.

Mongrel just uses Tempfile.  Tempfile just uses Dir::tmpdir, provided
by tmpdir.rb, to determine the temporary directory.

Dir::tmpdir defaults to /tmp, but it checks some environment variables first.

ENV['TMPDIR']
ENV['TMP']
ENV['TEMP']
ENV['USERPROFILE']

Just set one of those to the directory that you want it to use.



Kirk Haines


More information about the Mongrel-users mailing list