Uploading file is not working
Posted
by VinTem
on Stack Overflow
See other posts from Stack Overflow
or by VinTem
Published on 2010-03-08T00:57:04Z
Indexed on
2010/03/08
1:01 UTC
Read the original article
Hit count: 288
ruby-on-rails
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
© Stack Overflow or respective owner