# File is not getting saved using paperclip

**URL:** <https://www.ruby-forum.com/t/file-is-not-getting-saved-using-paperclip/196994>\
**Category:** Rails\
**Created:** [September 4, 2009, 12:42pm UTC](https://www.ruby-forum.com/t/file-is-not-getting-saved-using-paperclip/196994 "2009-09-04T12:42:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![akramwasim1234](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/b3f665/32.png) [@akramwasim1234](https://www.ruby-forum.com/u/akramwasim1234)\
**Post date:** [September 4, 2009, 12:42pm UTC](https://www.ruby-forum.com/t/file-is-not-getting-saved-using-paperclip/196994/1 "2009-09-04T12:42:02Z")

</div>

Hi all I have a form which contains attachments but the attachment is  
not getting created in file system and the fields for the attachment  
in DB is not getting filled when a new form is created .

I’m using paperclip

I hope the problem is with view part html=\>:multipart (as I’m using a  
single form to create multiple instances)

My Controller:

def create  
@ins=params[:ins].values.collect{|ins|InsPol.new(ins)}  
respond\_to do |format|  
if @ins.all?(&:valid?)  
@ins.each(&:save!)

```
 format.html { redirect_to :action => 'index'}
else

    format.html {render :action => 'new'}

 end

```

end

def new  
@ins = Array.new(3.times){InsPol.new}  
end

My view:

\<%= form\_tag({:action =\> :create}, {:multipart =\> true}) %\>  
\<% @ins.each\_with\_index do |ins, index| %\>  
\<% fields\_for “ins[#{index}]”, ins do |f| %\>  
\<%= f.text\_field :pol\_number%\>  
\<%= f.file\_field :attachment%\>  
\<% end %\>  
  
  
\<% end %\>  
\<%= submit\_tag “Save”%\>

My Model:

class InsPol \< ActiveRecord::Base  
has\_attached\_file :attachment

end

Moreover i have All the db migration for this attachment using  
paperclip and paperclip installed properly

Plz help me in this regard
