[Mongrel] Uploading Large (100mb+) files

Matt White stockliasteroid at gmail.com
Tue Nov 28 14:50:03 EST 2006


Rogelio,

It will arrive in Rails just like any other uploaded file... It will show up
in params[:model][:file_field], or whatever you've named your input file
field. Until you do something else with it, it only lives as a file in
/tmp/. You need to move it somewhere else, though, because Rails will do
away with it once the request is complete :)

Something like:

@file = params[:model][:file_field]
File.open("/path/to/#{@file.original_filename}", "wb") { |file| file.write(@
file.read) }

Would copy the file from it's temp location to /path/to/original_filename on
your box. As you were wondering, it will end up on whatever machine is
hosting the mongrel that the client was connected to. So, you may need to
scp it to an assets server or something when it's done... That's as far as I
can go without knowing more about your setup ;)

Hope this helps!

Matt

On 11/29/06, Rogelio Samour <rogelio.samour at gmail.com> wrote:
>
> Philip: at this point I want to upload something... anything. I'm
> following the example on the mongrel_upload_plugin and though it says
> finished I don't see the file anywhere. I Turned on --debug and I can only
> see that it's at least getting the headers (content-type, etc) on the
> uploaded file... but nothing on the whereabouts.
>
> Like I mentioned before, I'm very green when it comes to mongrel...
> however I'm decently versed in sysadmin *nix stuff... apache and friends.
> I'm just needing a nudge in the right direction. :-)
>
> cheers,
>
> -rjs-
>
> On 11/28/06, Philip Hallstrom <mongrel at philip.pjkh.com> wrote:
> >
> > > I have an Apache 2.2.3 (mod_proxy_balancer) frontend server that does
> > > not have mongrel installed. It does proxy requests to several other
> > > mongrel-only servers (each running 2 mongrel processes). Each mongrel
> > > node has the same rails code-base and it's working perfectly.
> > >
> > > However, my question is when I add an upload file form... where is it
> > > going to physically put that file? I mean since it's hitting either
> > one
> > > node or the other, so how does mongrel deal with that? and how or
> > where
> > > do I tell it to accept large files (100mb+) ?
> >
> > Others have given good advice on how to do it, but wanted to say you
> > don't
> > need to do anything to get it to accept 100mb files.  We do that quite a
> >
> > bit and while it takes awhile works just fine.  It does tie up a mongrel
> > process, but we're okay with that.
> >
> > >
> > > I have read on having an upload-only mongrel process, but again how
> > will
> > > all the other mongrels know to post the file to it or to a specific
> > > folder somewhere? Direction on this would be greatly appreciated!
> > >
> > > Thanks for your help on this. I searched the forum and didn't find
> > > anything specifically dealing with this. I have also checked the
> > mongrel
> > > docs and most of the setups talk about mongrel_upload_progress plugin
> > > and/or the mongrel_cluster setup...(I may have missed something :-/)
> > >
> > >
> > > cheers,
> > >
> > > -rjs-
> > >
> > > p.s. mongrel ROCKS!
> > >
> > > _______________________________________________
> > > Mongrel-users mailing list
> > > Mongrel-users at rubyforge.org
> > > http://rubyforge.org/mailman/listinfo/mongrel-users
> > >
> > _______________________________________________
> > Mongrel-users mailing list
> > Mongrel-users at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/mongrel-users
> >
>
>
> _______________________________________________
> Mongrel-users mailing list
> Mongrel-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/mongrel-users
>
>


-- 
Matt White
-----------------------
Thermal Creative
http://blog.thermalcreative.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20061129/02b23577/attachment-0001.html 


More information about the Mongrel-users mailing list