It appears the uploadFile method is getting called because its redirecting to :index, which doesn't exist now since you deleted it.
There are many issues here, but try the following:
1) put the code in uploadfile.html.erb in app/views/upload/index.html.erb
2) uncomment the index action, but make it empty
Garrett Lancaster
rixter
February 1, 2011 3:17 PM
So, I commented out the index method in my controller, just leaving the view as before.
Now I get the error:
Unknown action
No action responded to index
so my question now is, why doesn't the method uploadFile get called in the controller from the view with this code:
<% form_tag ({:action => 'uploadFile'}, :multipart => true) do %>
<p><label for="upload_file">Select File</label> :
<%= file_field 'upload', 'datafile' %></p>
<%= submit_tag "Upload" %>
<% end %>
Still a mystery to me...
--rixter
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
rixter
February 1, 2011 3:07 PM
Thanks for catching my dumb error with the backslashes...(this is running on Linux after all...). As you can tell, I'm crudely cutting-&-pasting code from online examples...
Yes, there is a file app/views/upload/uploadfile.html.erb, which is the view for my Upload class.
I'm not sure why I'm rendering the file like that either -- it was just in an example I was trying to adapt to my purposes -- but I do know if I take it out, the form doesn't work anymore.
All I'm trying to do is have the Submit button feed the selected file to the controller correctly, and then to the model correctly, where the data gets imported into the database.
But I obviously still have major errors in how this is coded....
Any other suggestions appreciated...
Thanks again,
rixter
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No comments:
Post a Comment