Forum: Ruby mod_ruby CGI file upload fails because of TypeError ?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
A8c75ba3d60af9c11ae792a1a2b7582b?d=identicon&s=25 lg (Guest)
on 2006-01-05 23:39
(Received via mailing list)
hi guys,

i have written an ruby script handling fileupload using the regular
Ruby CGI class.

....
if tmpfile.kind_of?(Tempfile)
        print "creating via FileUtils !!"
        FileUtils.cp tmpfile.local_path.untaint, filename.untaint
        print "i was copied !!"
else
        File.open( filename.untaint, "wb"){ |file|
                file << tmpfile.read
        }
end
....

when executing the script i get the following strange error (copied
from apaches error.log)

/usr/lib/ruby/1.8/delegate.rb:90: warning: already initialized constant
Delegater
/usr/lib/ruby/1.8/delegate.rb:91: warning: already initialized constant
SimpleDelegater
[Thu Jan 05 22:31:52 2006] [error] mod_ruby: error in ruby
[Thu Jan 05 22:31:52 2006] [error] mod_ruby:
/usr/lib/ruby/1.8/tempfile.rb:12: superclass mismatch for class
Tempfile (TypeError)
[Thu Jan 05 22:31:52 2006] [error] mod_ruby:   from
/usr/lib/ruby/1.8/auto-reload.rb:77:in `load'
[Thu Jan 05 22:31:52 2006] [error] mod_ruby:   from
/usr/lib/ruby/1.8/auto-reload.rb:77:in `require'
[Thu Jan 05 22:31:52 2006] [error] mod_ruby:   from
/usr/lib/ruby/1.8/cgi.rb:986:in `read_multipart'
[Thu Jan 05 22:31:52 2006] [error] mod_ruby:   from
/usr/lib/ruby/1.8/cgi.rb:983:in `loop'
[Thu Jan 05 22:31:52 2006] [error] mod_ruby:   from
/usr/lib/ruby/1.8/cgi.rb:983:in `read_multipart'
[Thu Jan 05 22:31:52 2006] [error] mod_ruby:   from
/usr/lib/ruby/1.8/cgi.rb:1103:in `initialize_query'
[Thu Jan 05 22:31:52 2006] [error] mod_ruby:   from
/usr/lib/ruby/1.8/cgi.rb:2269:in `initialize'
[Thu Jan 05 22:31:52 2006] [error] mod_ruby:   from
/var/www/ab/import.rbx:5:in `new'
[Thu Jan 05 22:31:52 2006] [error] mod_ruby:   from
/var/www/ab/import.rbx:5
[Thu Jan 05 22:31:52 2006] [error] mod_ruby:   from
/usr/lib/ruby/1.8/apache/ruby-run.rb:53:in `load'
[Thu Jan 05 22:31:52 2006] [error] mod_ruby:   from
/usr/lib/ruby/1.8/apache/ruby-run.rb:53:in `handler'

I am using Apache/2.0.54, mod_ruby and Ruby 1.8.2 (2005-04-11) on
Debian Sarge.

can anyone help me out what happens ?

many regards,

lars
This topic is locked and can not be replied to.