Hi there,

I'm new to drupal, although I have played around with previous versions in the past. Anyway, I've been reading about the public files vs. private files issue. My question relates to downloadable files that we would want to sell. Would setting the files to private be a way where we could control downloads of purchased mp3's for example?

Not sure if I am explaining this right, but what we want is to have some files on the server for purchase, mp3s, pdfs whatever. After purchase (probably via paypal store/functionality) we want to send them a temporary link where they can download the file.

Is this best done with some other process entirely, or would setting files to private be one way of restricting downloads? I suppose the problem would be expiring users/accounts after they download, etc. So they cannot share the download URL.

Any thoughts are appreciated.

Comments

VM’s picture

The private method would be needed.

The trick is to store the files above the public root of you website, where they are inaccessible from the internet, and only accessible from your drupal installation. If done in this manner, then the folder cannot be browsed.

example:

home/public_html/index.php (your drupal installation)
home/public_html/files/ (default installation fiels folder)

you need:

home/files
home/public_html/index.php

After switching to private method, you would have to use a relative path to your files folder which is above the public root. /www/home/files

if you switch to private file system, but leave your files folder inside the public root, than they can be accessed by anyone (and search engines) regardless of private setting.

* paths in these examples are probably not exact for your setup. you will have to investigate your paths.

May want to look into the quickfile.module which may help with selling files.

doka’s picture

Have you found the quickfile module: http://drupal.org/project/quickfile ?

Doka

tdellaringa’s picture

Thank you both for the info. Wow, quickfile looks wonderful. That is exactly what I was hoping to do. So, do I assume then to use quickfile I need to set to private? (Seems like yes...)

Also...looks like I don't have permission to make a folder above my root (my path is /var/www/public) - in www. I think I can make a folder in my cgi-bin though...would that work?

VM’s picture

you should (or sysadmin should *host) be able to create a folder in www

I have not tested with cgi-bin

tdellaringa’s picture

Just talked to my host, because I have a shared server we can't do that (the folder above my root is a common folder among many clients) and I can't afford to move to a dedicated server at this time. So I guess we have to go public?

VM’s picture

Odd, I use a shared host and can create folders above the public root. Thus it is not a limitation of a shared host, just the host you are using.

If these files are left public, anyone can get to them, without paying, if the object is to generate sales, The public method will not be the way to go.

If this is a serious project, I would seek out a new host and be refunded by the host you are with now.

dami’s picture

hmmm... not your user home (root) but your doc root. You should be able to create dir one level above your www/ or public_html/