Well, I feel dumb.
I''ve decided to be very explicit about function call parens and the
hash
specifications for parameters.
Doing this:
<%= form_tag ({ :action => ''save_HTML'' },
{ :multipart => ''true'' }) %>
works fine.
Thanks,
Wes
Wes Gamble wrote:> Since I can''t get the fancy upload progress thing to work, I
thought
> that I would revert back to a regular file upload scenario.
>
> I have a very simple file upload form set up. It appears that my file
> parameter is coming into the controller as a string, not a file object.
>
> Here''s my view:
>
> <%= form_tag :action => ''save_HTML'',
> :multipart => ''true'' %>
> <%= file_field ''eSimplyJob'',
''file'' %>
> <P>
> <%= submit_tag "Upload" %>
> </P>
> <%= end_form_tag %>
>
>
> Here''s my controller method:
>
> public
> def save_HTML
> @filename = @params[:eSimplyJob][:file].original_filename
> File.open("#{RAILS_ROOT}/htmlfiles/#{@filename}",
"wb") do |f|
> f.write(@params[:eSimplyJob][:file].read)
> end
> puts "Finished with save_HTML"
> end
>
> When I execute the upload, I get the following error:
>
> undefined method `original_filename'' for
"upload.rhtml":String
>
> I understand that this means that @params[:eSimplyJob][:file] is a
> String and not an IO object.
>
> What am I doing wrong?
>
> Thanks for any help.
>
> Wes Gamble
--
Posted via http://www.ruby-forum.com/.