# Papaerclip file name and special characters

**URL:** <https://www.ruby-forum.com/t/papaerclip-file-name-and-special-characters/189871>\
**Category:** Rails\
**Created:** [June 9, 2010, 9:32am UTC](https://www.ruby-forum.com/t/papaerclip-file-name-and-special-characters/189871 "2010-06-09T09:32:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tom-mac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/bc8723/32.png) [@tom-mac](https://www.ruby-forum.com/u/tom-mac)\
**Post date:** [June 9, 2010, 9:32am UTC](https://www.ruby-forum.com/t/papaerclip-file-name-and-special-characters/189871/1 "2010-06-09T09:32:57Z")

</div>

Hi  
I have a problem checking the uniquness of filename. My rails  
controller code is

## if params[:document][“attachment”] && (current\_user.documents.find(:all).map(&:attachment\_file\_name).include? params[:document][“attachment”].original\_filename) flash[:error] = “File already exists” else #store file

```
    I am using database storage. Now suppose if I am saving the file

```

cli ent&&list.gif paperclip save the attachemnt\_file\_name as  
cli\_ent\_list.gif  
Again I am trying to upload the same file and in the above code it  
goes to the else part and save the file since  
params[:document][“attachment”].original\_filename will be  
cli ent&&list.gif

I cant use validatesuniquness because of some reasons and have to use  
the above code. Please tell me how can I solve this issue?

Thanks  
Tom
