Connecting Tech Pros Worldwide Forums | Help | Site Map

Download Link

Newbie
 
Join Date: Feb 2007
Posts: 7
#1: Feb 24 '09
A client needs to have download links sent to customers automatically after purchases. The links must expire after three days. I would prefer not to have the files be stored in a static location that is publicly accessible. I am wondering if there is any good way of having the permissions on a file be dynamically changing without constantly having scripts update .htaccess files. The other way I had been thinking about doing this would be to have the files to be downloaded be stored above the public_html folder but then somehow link to the files when an authorized user needs to download them. Any help on this matter would be greatly appreciated.

Newbie
 
Join Date: Feb 2007
Posts: 7
#2: Mar 4 '09

re: Download Link


I was doing some more thinking about this and was wondering if it would be feasible to make a perl script that printed a binary file(zip file probably)... Any thoughts?
KUB365's Avatar
Administrator
 
Join Date: Jul 2005
Location: Portland, OR
Posts: 975
#3: Mar 4 '09

re: Download Link


Use a php script to control downloading. You can then interface with a database to check how long the download should be available for download and what file the customer has access to.
Newbie
 
Join Date: Feb 2007
Posts: 7
#4: Mar 4 '09

re: Download Link


That was my initial thought, but I don't want users to be able to find out where the actual file is stored. If I just point to a static file location they could look at that and share it with whomever, not to mention that they could then get around the three day limit.
Markus's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,949
#5: Mar 5 '09

re: Download Link


Quote:

Originally Posted by mastahyeti View Post

That was my initial thought, but I don't want users to be able to find out where the actual file is stored. If I just point to a static file location they could look at that and share it with whomever, not to mention that they could then get around the three day limit.

Not if you have the file outside of the root folder. If your directory setup is server/domain/htdocs/, putting the file in the /domain/ directory means anyone browsing your site does not have access to it. You can then use a php file to read the file (readfile()) and force a download - after checking the user has permissions, etc.
Reply