Best practice for downloadable product?

My RoR site will offer a software product with a freebie reduced
functionality
version and a for sale version. I’ve done the store site except for the

downloading and credit card processing. For the latter I’ve
investigated and made
some choices.

But to support downloading the product, what are the best practices?
Are there code snippets available? Is it better to do this with a
‘secret url’
or what? I’m a newbie at this particular thing.
If you have a sense of security or other trade-offs, I’d much
appreciate your
input. thanks so much.

Hello,

On 30 Oct 2006, at 20:07, minka wrote:

But to support downloading the product, what are the best practices?
Are there code snippets available? Is it better to do this with a
‘secret url’
or what? I’m a newbie at this particular thing.
If you have a sense of security or other trade-offs, I’d much
appreciate your
input. thanks so much.

I’m not sure about best practices here, but this simple approach works:

  1. Store your product somewhere on the file system where it can’t be
    reached from a URL, i.e. outside the public/ directory.

  2. Write an action in your controller which uses send_file [1] to
    send your product to the browser. You can add in any other behaviour
    you like in this action such as counting the number of downloads,
    only sending the file if it’s Tuesday and the caller’s IP address is
    an even number, etc.

Hope that helps,
Andy S.

[1] http://api.rubyonrails.org/classes/ActionController/
Streaming.html#M000072