[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

save file

misiek

2/28/2006 10:24:00 PM

my form

<%= form_tag :action => 'upload', :id => @property.id %>
<%= file_field 'images', 'name' %>
<%= submit_tag "send" %>
<%= end_form_tag %>

@user = "new_image"
File.open("#{RAILS_ROOT}/public/images/#{@user}.jpg", "wb") do |f|
f.write(@params['name'])
end

and ? and nothing o got new_image.jpg file but is empty


I wa trying like
f.write(File.open(@params['image_file']).read)
than A got error

Can't convert Array into String

so what I am doing wrong ?
3 Answers

James Gray

3/1/2006 4:28:00 AM

0

On Feb 28, 2006, at 7:57 PM, misiek wrote:

> my form
>
> <%= form_tag :action => 'upload', :id => @property.id %>

Should that be:

<%= form_tag({:action => "upload", :id => @property}, :multipart =>
true) %>

?

James Edward Gray II


misiek

3/1/2006 4:55:00 PM

0

James Edward Gray II wrote:
> On Feb 28, 2006, at 7:57 PM, misiek wrote:
>
>> my form
>>
>> <%= form_tag :action => 'upload', :id => @property.id %>
>
>
> Should that be:
>
> <%= form_tag({:action => "upload", :id => @property}, :multipart =>
> true) %>
>
> ?
>
> James Edward Gray II
>
>

yes that's correct , thanks

Eric Luo

3/11/2006 3:13:00 AM

0

>>>>> "James" == James Edward Gray <james@grayproductions.net> writes:
I have the same problem.
It works,
Thanks
James> On Feb 28, 2006, at 7:57 PM, misiek wrote:
>> my form
>>
>> <%= form_tag :action => 'upload', :id => @property.id %>

James> Should that be:

James> <%= form_tag({:action => "upload", :id => @property}, :multipart =>
James> true) %>

James> ?

James> James Edward Gray II