[Mongrel] failed to allocate memory while downloading large files

Amit Tomar lists at ruby-forum.com
Tue Sep 14 08:50:21 EDT 2010

Luis Lavena wrote:
> On Tue, Sep 14, 2010 at 9:39 AM, Amit Tomar <lists at ruby-forum.com> 
> wrote:
>> sorry luis but i didn't get you
>> i uploaded my file in filesystem than how ?can ?i place file in public
>> folder
>> could you please give some example??
> Are you using a plugin to manage your uploads? How are you saving the 
> file?
> Take the temporary file and use File.move or FileUtils.mv, wonder what
> are you doing right now for that.
> Please use google to search, there are plenty of file uploading
> tutorials about Ruby on Rails on the internet covering "do from
> scratch" or using gem/plugins.
> --
> Luis Lavena
> AREA 17
> -
> 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鲹

this is how am uploading
def upload(params)

        path = get_path(params)
        File.open(path, "wb") do |f|
        while buff= params[:location].read(4096)


def get_path(params)
          name = params[:location].original_filename
    directory  = "//"
                path = File.join(directory, name)
          return path

def copyFile(uploaded_file)
            @uploaded_file = uploaded_file
            directory = "//"
            #url_dir = "data"
            url_dir = "//"
            name = File.basename(@uploaded_file)
            path = File.join(directory, name)
          if (!FileTest.exist?(path))
             FileUtils.copy @uploaded_file, path
               return "duplicate"

            url = File.join(url_dir, name)
            return url


and after copying it filesystem
Posted via http://www.ruby-forum.com/.

More information about the Mongrel-users mailing list