Simple file upload

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

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

Thanks!

On Mon, Apr 21, 2008 at 11:27 AM, Mike Nicholaides <
[email protected]> wrote:

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

Posted via http://www.ruby-forum.com/.


Bruno Guimarães Sousa
Ciência da Computação UFBA
Registered Linux user #465914

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

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