Hi,
In message "Re: CGI uses file size to distinguish between regular values and files"
on 03/11/04, Tanaka Akira <akr / m17n.org> writes:
|> I understand the problem, but not yet think of the best solution. Any
|> concrete ideas?
|
|I think
|
| File.open(upload, 'w') {|f| f.write(file.read) }
|
|is good enough except it reads whole file in memory at once. It is
|a problem for big file.
|
|So I propose IO#copy and StringIO#copy to able to write:
|
| File.open(upload, 'w') {|f| file.copy(f) }
How about
require 'fileutils'
File.open(upload, 'w') {|f| FileUtils.copy_stream(file,f)}
? It's bit longer, but works now without any modifies.
matz.