# Simple file upload

**URL:** <https://www.ruby-forum.com/t/simple-file-upload/135362>\
**Category:** Rails\
**Created:** [April 21, 2008, 3:41pm UTC](https://www.ruby-forum.com/t/simple-file-upload/135362 "2008-04-21T15:41:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bruno\_GuimarSSSSes\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/49beb7/32.png) [@Bruno\_GuimarSSSSes\_S](https://www.ruby-forum.com/u/Bruno_GuimarSSSSes_S)\
**Post date:** [April 21, 2008, 3:41pm UTC](https://www.ruby-forum.com/t/simple-file-upload/135362/1 "2008-04-21T15:41:24Z")

</div>

Hi people,

I’ve tried many ways to upload files in rails 2.0. None of them with  
success.

I want to do it the simplest way.  
Any suggestions? Any tutorial on the web?

## Best regards,

Bruno GuimarÃ£es Sousa  
CiÃªncia da ComputaÃ§Ã£o UFBA  
Registered Linux user #465914

---

<div class="post-metadata">

**Author:** ![Bruno\_GuimarSSSSes\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/49beb7/32.png) [@Bruno\_GuimarSSSSes\_S](https://www.ruby-forum.com/u/Bruno_GuimarSSSSes_S)\
**Post date:** [April 21, 2008, 4:27pm UTC](https://www.ruby-forum.com/t/simple-file-upload/135362/2 "2008-04-21T16:27:07Z")

</div>

have you looked at paperclip? I hear it’s pretty simple

---

<div class="post-metadata">

**Author:** ![Bruno\_GuimarSSSSes\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/49beb7/32.png) [@Bruno\_GuimarSSSSes\_S](https://www.ruby-forum.com/u/Bruno_GuimarSSSSes_S)\
**Post date:** [April 22, 2008, 2:02am UTC](https://www.ruby-forum.com/t/simple-file-upload/135362/3 "2008-04-22T02:02:40Z")

</div>

Thanks!

On Mon, Apr 21, 2008 at 11:27 AM, Mike Nicholaides \<  
removed\_email\_address@domain.invalid\> wrote:

> ## have you looked at paperclip? I hear it’s pretty simple
> 
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> >

–  
Bruno GuimarÃ£es Sousa  
CiÃªncia da ComputaÃ§Ã£o UFBA  
Registered Linux user #465914

---

<div class="post-metadata">

**Author:** ![Bruno\_GuimarSSSSes\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/49beb7/32.png) [@Bruno\_GuimarSSSSes\_S](https://www.ruby-forum.com/u/Bruno_GuimarSSSSes_S)\
**Post date:** [April 24, 2008, 8:52am UTC](https://www.ruby-forum.com/t/simple-file-upload/135362/4 "2008-04-24T08:52:22Z")

</div>

hi im anas  
i’ll explain how to upload files to ur app  
require ‘fileutils’  
require ‘digest/sha2’

class User \< ActiveRecord::Base  
def self.register\_user(register)

image\_of = register[‘photo\_url’].original\_filename  
binary\_data=register[‘photo\_url’].read(reading binary data)  
new\_user = User.new  
new\_user.name = register[‘first\_name’]+’  
'+register[‘last\_name’]  
new\_user.email = register[‘email\_id’]  
new\_user.password =  
Digest::SHA256.hexdigest(register[‘user\_pwd’])  
new\_user.photo\_url = register[‘photo\_url’].original\_filename  
(storing in db only file name)  
new\_user.user\_type=1  
new\_user.save  
File.open(“public/profileImages/#{image\_of}”, “wb”) { |f|  
f.write(binary\_data)}  
("this will store ur file in /public/profileimages/“with filename”)  
end

i hope it’ll clarify ur doubts…  
it’s benn sucessfully working…  
thanq mohd anas

---

<div class="post-metadata">

**Author:** ![Bruno\_GuimarSSSSes\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/49beb7/32.png) [@Bruno\_GuimarSSSSes\_S](https://www.ruby-forum.com/u/Bruno_GuimarSSSSes_S)\
**Post date:** [April 24, 2008, 11:38am UTC](https://www.ruby-forum.com/t/simple-file-upload/135362/5 "2008-04-24T11:38:03Z")

</div>

hi  
i have used country\_select in my form to let the user  
choose her/his  
country now the only problem is that i have to convert  
these english names to Farsi because the whole site is  
in Farsi.  
does any one know how can i do that?  
thank you

```
  ____________________________________________________________________________________

```

Be a better friend, newshound, and  
know-it-all with Yahoo! Mobile. Try it now.  
[http://mobile.yahoo.com/;\_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ](http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ)
