From: Dmitry Borodaenko Date: 2003-11-04T04:44:50+09:00 Subject: Re: CGI uses file size to distinguish between regular values and files On Tue, Nov 04, 2003 at 01:25:31AM +0900, Austin Ziegler wrote: > On Tue, 4 Nov 2003 00:43:49 +0900, Jesper Olsen wrote: > > Anyway, my code looks like this (upload.rbx) > > cgi=CGI.new > > if cgi.has_key?('image') > > image=cgi['image'][0].read > > end > This is what I *don't* want. I shouldn't *have* to handle it > differently (I think that the Perl mechanism is even worse), but I > should be able handle it differently if I want. Session#params in samizdat/session.rb in Samizdat: def params(keys) result = [] for key in keys value = self[key] raise UserError, "Input size exceeds content size limit" if value.methods.include? :size and value.size > config['limit']['content'] result << case value when String then (value =~ /[^\s]/)? value.to_s : nil when StringIO, Tempfile then value.read else nil end end return result end Is that what you want? -- Dmitry Borodaenko