# Problem in file uploading

**URL:** <https://www.ruby-forum.com/t/problem-in-file-uploading/92603>\
**Category:** Rails\
**Created:** [April 21, 2007, 12:17pm UTC](https://www.ruby-forum.com/t/problem-in-file-uploading/92603 "2007-04-21T12:17:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ramesh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/d07c76/32.png) [@ramesh](https://www.ruby-forum.com/u/ramesh)\
**Post date:** [April 21, 2007, 12:17pm UTC](https://www.ruby-forum.com/t/problem-in-file-uploading/92603/1 "2007-04-21T12:17:52Z")

</div>

Hai

```
According to the http://wiki.rubyonrails, I am trying to do the file

```

uploading .

here i am sending my code

@file\_data=@params[‘label\_upload’][‘send\_file’]  
@params[‘sendfile\_label’][‘filename’] =  
@file\_data.original\_filename.gsub(/[^\w.\_-]/, ‘’) # This makes sure  
filenames are sane  
@params[‘sendfile\_label’][‘file\_content’] =  
@params[‘label\_upload’][‘send\_file’].read  
@params[‘label\_upload’].delete(‘send\_file’) # let’s remove the  
field from the hash, because there’s no such field in the DB anyway.

If i try to excute this code its giving the following error…

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

Can any body facing this kind of problem…

regards  
ramesh
