[Mongrel] failed to allocate memory while downloading large files

Luis Lavena luislavena at gmail.com
Tue Sep 14 09:11:24 EDT 2010

On Tue, Sep 14, 2010 at 9:50 AM, Amit Tomar <lists at ruby-forum.com> wrote:
> this is how am uploading
> def upload(params)
>        path = get_path(params)
>        File.open(path, "wb") do |f|
>        while buff= params[:location].read(4096)
>        f.write(buff)
>        end
>        end
> end

That is copying the file every 4k for you, you can simply File.move
form the temporay filename to the final name in your remote location.

It is expected you dispose the temporary file when you're done with it.

Please see how proper file uploading and processing is done with Ruby on Rails.
Luis Lavena
Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry

More information about the Mongrel-users mailing list