# Problem with multiple file attachment

**URL:** <https://www.ruby-forum.com/t/problem-with-multiple-file-attachment/106198>\
**Category:** Rails\
**Created:** [June 7, 2007, 12:00pm UTC](https://www.ruby-forum.com/t/problem-with-multiple-file-attachment/106198 "2007-06-07T12:00:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![guest](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/8dc957/32.png) [@guest](https://www.ruby-forum.com/u/guest)\
**Post date:** [June 7, 2007, 12:00pm UTC](https://www.ruby-forum.com/t/problem-with-multiple-file-attachment/106198/1 "2007-06-07T12:00:49Z")

</div>

hi,

actually i have done single file attachment in ruby on rails, now i  
want to do multiple attachment, but the problem is when i am trying to  
display the second file name from the params for the testing purpose, i  
got the error, please can anyone correct the error.

in view:

 \<%= file\_field("picture", "file") %\> \<%= file\_field("test", "file") %\> 

in controller:

if request.post?  
@picture=params[:picture][:file]  
@filename = @picture.original\_filename  
@test=params[:test][:file]  
render\_text @filename1 = @picture1.original\_filename  
end

my Error is:

undefined method `original\_filename’ for “”:String

---

<div class="post-metadata">

**Author:** ![guest](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/8dc957/32.png) [@guest](https://www.ruby-forum.com/u/guest)\
**Post date:** [June 7, 2007, 12:13pm UTC](https://www.ruby-forum.com/t/problem-with-multiple-file-attachment/106198/2 "2007-06-07T12:13:42Z")

</div>

sorry this is my controller

if request.post?  
@picture=params[:picture][:file]  
@filename = @picture.original\_filename  
@test=params[:test][:file]  
render\_text @filename1 = @test.original\_filename  
end
