Forum: Ruby on Rails [Rails]Uploading file

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
C2d5a90c724ca4a7730f6f422c81e525?d=identicon&s=25 Kushan Jayathilake (Guest)
on 2007-03-21 12:46
(Received via mailing list)
Hi guys

is there anyone who knows how to upload files?
can u give me the required codings?

Thx
Regards
Kushan
781bda58d641b468092d36f4abda0170?d=identicon&s=25 glenn (Guest)
on 2007-03-21 12:56
(Received via mailing list)
> is there anyone who knows how to upload files?
> can u give me the required codings?

http://wiki.rubyonrails.org/rails/pages/HowtoUploadFiles
C2d5a90c724ca4a7730f6f422c81e525?d=identicon&s=25 Kushan Jayathilake (Guest)
on 2007-03-21 13:21
(Received via mailing list)
i already followed wht that page says, but it wont work
can anyone give me codings
im sure some one may have done file uploading

Regards
Kushan
781bda58d641b468092d36f4abda0170?d=identicon&s=25 glenn (Guest)
on 2007-03-21 13:27
(Received via mailing list)
> i already followed wht that page says, but it wont work
> can anyone give me codings
> im sure some one may have done file uploading

Someone has, and they posted the code on the wiki. If it's not working
then it would be more helpful to know what error you are getting.
C2d5a90c724ca4a7730f6f422c81e525?d=identicon&s=25 Kushan Jayathilake (Guest)
on 2007-03-21 13:55
(Received via mailing list)
this is the error i got

undefined method 'read'  for "c:\\modernchef.txt":String

this is the  model that i wrote

 def self.save(metro_upload)
    File.open("Metro_SQL/#{metro_upload['name']}/metro.sql", "w") {

     |f|

     $readedFile = f.read(metro_upload['sql_file'].read)

     f.write($readedFile)
    }


  end

end


<http://wiki.rubyonrails.org/rails/pages/HowtoUploadFiles>
37c7c5f685b0c8ffaa0fd43d66eb7a8d?d=identicon&s=25 mixplate (Guest)
on 2007-03-21 13:56
check out railsgrunt.com to upload multiple files.

Kushan Jayathilake wrote:
> Hi guys
>
> is there anyone who knows how to upload files?
> can u give me the required codings?
>
> Thx
> Regards
> Kushan
0c344de5db3869f5d9e9a3b57bce62fa?d=identicon&s=25 Chad (Guest)
on 2007-03-21 14:41
(Received via mailing list)
Check out the acts_as_attachment plugin it works great. Here is a
tutorial for it from the author of the plugin
http://weblog.techno-weenie.net/articles/acts_as_attachment
A5c5da3240c5ddd0ab2eb8546478726e?d=identicon&s=25 Colin Strasser (Guest)
on 2007-03-21 15:09
(Received via mailing list)
Your bug is probably in this line:

>      $readedFile = f.read(metro_upload['sql_file'].read)

Since that's the only one with calls to a method named 'read' (note
the error message).  And since f.read is definitely a valid method
call, the second one would seem the likely culprit.  Why are you
calling metro_upload['sql_file'].read?  Isn't the value of
metro_upload['sql_file'] "c:\\modernchef.txt"?


On 3/21/07, Kushan Jayathilake <kushan.rails@gmail.com> wrote:
>
> end
> > then it would be more helpful to know what error you are getting.
--
Colin Strasser
Union Square Internet Development
917.723.6930 (m)
646.219.0332 (f)
67f0a5d18312a73254262c80ddd7107e?d=identicon&s=25 Denis (Guest)
on 2007-03-21 21:01
Kushan Jayathilake wrote:
> this is the error i got
>
> undefined method 'read'  for "c:\\modernchef.txt":String
>


have you enctype="multipart/form-data" among your form attributes?
E3513c4edd6810bb4b9914b58da2a2c3?d=identicon&s=25 Jamal Soueidan (jamal)
on 2007-03-21 22:37
And give permission, 0777
0636af313dcd95d923e0875d50875db3?d=identicon&s=25 Robert (Guest)
on 2007-03-22 00:01
(Received via mailing list)
Hi,

You can use 'file_column' to control file/image uploadings

Cheers,
Robert

On Mar 22, 9:37 am, Jamal Soueidan <rails-mailing-l...@andreas-s.net>
This topic is locked and can not be replied to.