Uploading file is not working
I have done the following form
<% form_for @anexo, :url => {:action => "create"}, :html => {:multpart => true} do |f| %>
<%= f.error_messages %>
<p>
<%= f.label :descricao, "Descrição"%>
<%= f.text_field :descricao %>
</p>
<p>
<%= f.label :arquivo_anexo, "Arquivo Anexo" %>
<%= f.file_field :arquivo_anexo %>
</p>
<p>
<%= f.submit "Adicionar anexo" %>
</p>
<% end %>
With a model like this:
def arquivo_anexo=(novo_arqquivo)
self.arquivo = novo_arquivo.read
self.nome = File.basename(novo_arquivo.original_filename)
self.content_type = novo_arquivo.content_type.chomp
end
But when I my file is not been sent through the form. When I check the params array using the debugger the data is 开发者_运维技巧not sent.
Does anyone have any idea or sugestions? Thanks
Just a quick guess, but could it be that you have:
:multpart => true
instead of:
:multipart => true
(i.e. you're missing an i)
精彩评论