Hello,
So, I did this website for a client; one part gives users the opportunity
to download various documents (generally Word documents) but they have to
pay for that. We use micropayments. Upon payment, a script looks up the
file name in a database, establishes a url, and the dl begins. I want to
protect the directory the downloadable files reside in; obviously an
htaccess directive would prevent all access and thence all downloads. So
I thought of this: store the files in an htaccess-protected directory,
and when it is requested, copy it to a public directory, give it a random
name, and feed the url to the browser. To prevent files from piling up in
the download directory, I would have to set up a task (cron job?) to
delete all files whose date of creation (or last access) is more the a
given period of time. The idea here is also to prevent anyone from, say,
jotting down the file's url and access it at a date. Granted, he/she/it
did pay for the file but he/she/it could as well pass the url on to
someone else.
What do you think about that; both on the principle and on the
methodology.
Thanks
I realize it might not be the correct group to ask such a question, but
someone here perhaps has come accross a similar issue
So, I did this website for a client; one part gives users the opportunity
to download various documents (generally Word documents) but they have to
pay for that. We use micropayments. Upon payment, a script looks up the
file name in a database, establishes a url, and the dl begins. I want to
protect the directory the downloadable files reside in; obviously an
htaccess directive would prevent all access and thence all downloads. So
I thought of this: store the files in an htaccess-protected directory,
and when it is requested, copy it to a public directory, give it a random
name, and feed the url to the browser. To prevent files from piling up in
the download directory, I would have to set up a task (cron job?) to
delete all files whose date of creation (or last access) is more the a
given period of time. The idea here is also to prevent anyone from, say,
jotting down the file's url and access it at a date. Granted, he/she/it
did pay for the file but he/she/it could as well pass the url on to
someone else.
What do you think about that; both on the principle and on the
methodology.
Thanks
I realize it might not be the correct group to ask such a question, but
someone here perhaps has come accross a similar issue
Comment