Remote file storage using File Column plugin

Posted by anup.narkhede on February 10, 2008

Many times I came across a need to fetch remote data (video files/images) and store them on file system. Searching for a way, I came up with this approach.

The example is about a Video class with a video_file ‘file_column’. To fetch and store a remote file instead of getting it as a post parameter, we need to do some code workaround. The example below demonstrates one approach.

Usage:

My model looks as simple as this:

Trackbacks

Use this link to trackback from your own site.

Comments

Leave a response

  1. Jim Cropcho Sun, 10 Feb 2008 11:21:47 PST

    It seems like this implementation would be required fairly frequently. I am not very familiar with file_column, but if this methodology is indeed not built into the plugin, perhaps you should consider contacting Sebastian Kanthak regarding committing a more generalized implementation into file_column.

    Although I’m not familiar with how Rails’ caching works, I can at least say that the rest of it looks good!

  2. anup.narkhede Sun, 10 Feb 2008 19:54:46 PST

    Thanks Jim,

    I am looking at a possibility to integrate this feature with file_column plugin. Regarding caching, I am not sure if I am making proper use of that directory, may be I should use a separate directory (inside temp) specially created for temporary storage.

    Anup

Comments