Forum: Ruby on Rails Uploading files and writing them to server?

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.
59ea1b450935b9d70abfec4186b7a4d5?d=identicon&s=25 Jeff Coleman (progressions)
on 2006-03-29 19:36
Where should I look for information on how to use Rails and Ruby to
accept the upload of a file and then to save that file to the file
system of my server?

I'm reading the "Uploading a file" section of Agile Web Dev with Rails,
but it's geared toward saving the file in the database.

Any advice?

Thanks,
Jeff
D4b246038154d7cc2363256bd25a4fe0?d=identicon&s=25 Larry White (Guest)
on 2006-03-29 19:57
(Received via mailing list)
If I remember correctly I used the AWDR example for the front-end and
did
the back-end piece after reading the file handling info from the
Programming
Ruby book - roughly in this section.

http://www.ruby-doc.org/docs/ProgrammingRuby/html/...

If you  haven't tried the Ruby Sidebar, yet. It's a great resource.
34f5b045aec62235c17458650ea75353?d=identicon&s=25 Steve Koppelman (hatless)
on 2006-03-29 20:00
Google for the file_column plugin. It handles many of the minutae like
figuring out where in the filesystem to store the files, handling the
form field gracefully when it comes to updating the database record that
references it, etc., all through a one-line declaration in the model and
a string (varchar) field for the filename. And if they're image files,
it's got hooks into RMagick, ImageMagick, etc. for creating and caching
resized and otherwise processed versions of the image.

Not perfect but applicable to most situations and a whole lot easier
than reinventing the wheel.

Jeff Coleman wrote:
>
> Where should I look for information on how to use Rails and Ruby to
> accept the upload of a file and then to save that file to the file
> system of my server?
>
> I'm reading the "Uploading a file" section of Agile Web Dev with Rails,
> but it's geared toward saving the file in the database.
>
> Any advice?
>
> Thanks,
> Jeff
59ea1b450935b9d70abfec4186b7a4d5?d=identicon&s=25 Jeff Coleman (progressions)
on 2006-03-29 20:18
Thanks, Steve, that is exactly what I'm looking for!

I've just started playing with RMagick, as well.  I have a model named
Image, which seems to be causing a namespace conflict.  Is there a way I
can resolve that without changing my model?

Jeff

Steve Koppelman wrote:
> Google for the file_column plugin. It handles many of the minutae like
> figuring out where in the filesystem to store the files, handling the
> form field gracefully when it comes to updating the database record that
> references it, etc., all through a one-line declaration in the model and
> a string (varchar) field for the filename. And if they're image files,
> it's got hooks into RMagick, ImageMagick, etc. for creating and caching
> resized and otherwise processed versions of the image.
>
> Not perfect but applicable to most situations and a whole lot easier
> than reinventing the wheel.
>
> Jeff Coleman wrote:
>>
>> Where should I look for information on how to use Rails and Ruby to
>> accept the upload of a file and then to save that file to the file
>> system of my server?
>>
>> I'm reading the "Uploading a file" section of Agile Web Dev with Rails,
>> but it's geared toward saving the file in the database.
>>
>> Any advice?
>>
>> Thanks,
>> Jeff
This topic is locked and can not be replied to.