Re: file uploading
Daniel Bretoi <[email protected]>
| Newsgroups | gmane.comp.apache.mod-ruby |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I must have being doing something wrong in context, because I just tried
the little snippet I pasted, and it seems to be doing more things right.
However, with this code, I get:
[Fri Jan 23 09:23:19 2004] [error] mod_ruby: error in ruby
/usr/lib/ruby/1.8/cgi.rb:1039:in `read_multipart': undefined method
`dump' for nil:NilClass (NoMethodError)
from /usr/lib/ruby/1.8/cgi.rb:987:in `loop'
from /usr/lib/ruby/1.8/cgi.rb:1076:in `read_multipart'
from /usr/lib/ruby/1.8/cgi.rb:1116:in `initialize_query'
from /usr/lib/ruby/1.8/cgi.rb:2299:in `initialize'
from /tmp/blah.rhtml.28802.0:1:in `new'
from /tmp/blah.rhtml.28802.0:1
from /usr/lib/ruby/1.8/apache/eruby-run.rb:113:in `load'
from /usr/lib/ruby/1.8/apache/eruby-run.rb:113:in `run'
from /usr/lib/ruby/1.8/apache/eruby-run.rb:78:in `handler'
full code:
<% require 'cgi'; @cgi = CGI.new %>
<% p @cgi.params['drop'].first %>
<form method='post' enctype='multipart/form-data'>
Drop Location: <input type=file name=drop>
<input type=submit name=submit>
</form>
On Fri, Jan 23, 2004 at 12:13:46PM -0500, Daniel Bretoi wrote:
> Hi,
>
> I've been searching through the archives, but I can't seem to get file
> uploading to work. Here is what I have.
>
> <% p @cgi.params['drop'].first %>
> <form method='post' enctype='multipart/form-data'>
> Drop Location: <input type=file name=drop>
> <input type=submit name=submit>
> </form>
>
> The code just returns the name of the file which is input into drop, not
> the file data.
>
> May I also suggest that the answer get's put on the modruby.org FAQ
> section as I'm sure it's a common request.
>
> Thanks,
>
> Daniel
>
> (@cgi is defined as: @cgi = CGI.new)
>
>
> --
> "The two aims of the Party are to conquer the whole surface of the earth
> and to extinguish once and for all the possiblity of independant thought."
> -- 1984, George Orwell
--
"The two aims of the Party are to conquer the whole surface of the earth
and to extinguish once and for all the possiblity of independant thought."
-- 1984, George Orwell