On Nov 28, 2006, at 1:50 PM, Matt White wrote:

> 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/[EMAIL PROTECTED]", "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 ;)
>

This is what I'd like to improve in Mongrel. It's really wasteful to  
write the file to a TempFile and then rewrite it again elsewhere. For  
really big files (multi-gigabyte) the performance hit would be  
tremendous.

I'm thinking furiously about how to properly manage this. If anyone  
has any ideas, feel free to share them on the list.

cr

_______________________________________________
Mongrel-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/mongrel-users

Reply via email to