# Save file

**URL:** <https://rubytalk.org/t/save-file/25299>\
**Category:** ruby-talk\
**Created:** [1 March 2006 01:57 UTC](https://rubytalk.org/t/save-file/25299 "2006-03-01T01:57:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![misiek](https://avatars.discourse-cdn.com/v4/letter/m/76d3ee/32.png) [@misiek](https://rubytalk.org/u/misiek)\
**Post date:** [1 March 2006 01:57 UTC](https://rubytalk.org/t/save-file/25299/1 "2006-03-01T01:57:20Z")

</div>

my form

\<%= form\_tag :action =\> 'upload', :id =\> @property.id %\>  
&nbsp;&nbsp;&nbsp;\<%= file\_field 'images', 'name' %\>  
&nbsp;&nbsp;&nbsp;\<%= submit\_tag "send" %\>  
\<%= end\_form\_tag %\>

@user = "new\_image"  
File.open("#{RAILS\_ROOT}/public/images/#{@user}.jpg", "wb") do |f|  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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 ?

---

<div class="post-metadata">

**Author:** ![James\_Edward\_Gray\_II](https://avatars.discourse-cdn.com/v4/letter/j/ea5d25/32.png) [@James\_Edward\_Gray\_II](https://rubytalk.org/u/James_Edward_Gray_II)\
**Post date:** [1 March 2006 04:27 UTC](https://rubytalk.org/t/save-file/25299/2 "2006-03-01T04:27:44Z")

</div>

Should that be:

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

?

James Edward Gray II

> **···**
>
> On Feb 28, 2006, at 7:57 PM, misiek wrote:
> 
> > my form
> > 
> > \<%= form\_tag :action =\> 'upload', :id =\> @property.id %\>

---

<div class="post-metadata">

**Author:** ![misiek](https://avatars.discourse-cdn.com/v4/letter/m/76d3ee/32.png) [@misiek](https://rubytalk.org/u/misiek)\
**Post date:** [1 March 2006 16:58 UTC](https://rubytalk.org/t/save-file/25299/3 "2006-03-01T16:58:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Eric\_Luo](https://avatars.discourse-cdn.com/v4/letter/e/ce73a5/32.png) [@Eric\_Luo](https://rubytalk.org/u/Eric_Luo)\
**Post date:** [11 March 2006 03:18 UTC](https://rubytalk.org/t/save-file/25299/4 "2006-03-11T03:18:43Z")

</div>

I have the same problem.  
It works,  
Thanks

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