SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Sep 2007
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    File Upload Form Ideas?

    I inherited a ruby site and the boss wants me to add a file upload form to one of the pages. Any suggestions? Should I store the files in a directory on the server or in the database? I prefeer the db but I do not know how to go about creating a table for the files. These are going to be large tif, jpg, etc files. I am new to all this so the baby talk is appreciated!

  2. #2
    SitePoint Guru
    Join Date
    Aug 2005
    Posts
    986
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  3. #3
    l 0 l silver trophybronze trophy lo0ol's Avatar
    Join Date
    Aug 2002
    Location
    Palo Alto
    Posts
    5,329
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's really a database question rather than a direct RoR question, but personally I'd opt for storing them in the file system rather than directly in the database. There's a few different reasons why, and I'm sure people could argue things back and forth, but I think having files easily accessible to the system at large is a good thing. For example- say you wanted to make thumbnails of all of your images. It would be pretty quick to just run some commands on a folder and convert them all that way. You could do the same if they were in the database, but I get the feeling it would take more processing time. Also, files just seem more accessible. You can just FTP to your box and pull them down directly if need be, and so on.

  4. #4
    SitePoint Evangelist
    Join Date
    Feb 2006
    Location
    Worcs. UK
    Posts
    404
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    When I started using Rails a couple of years ago, I found Sebastian Kanthak's file_column to be the simplest way to work with uploading files. Rails has moved on a lot since then, but file_column works well for me and I even found it fairly easy to modify the underlying code (to serve files directly from a IIS FTP server). It also has some nice feature such as integration with RMagick that may well suit your image file handling requirements.

    file_column stores the files in the applications public folder, and paths to those files in the database.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •