View Full Version : Limit File Downloads

04-02-2007, 09:09 PM
I'm now continuing a PHP project I was working on over the past week. Now I need a little more help. The script that I wrote creates a text file in a randomly named directory within another previously specified directory. My new objective is to delete the text file after the end-user has downloaded it. I'm not sure how I could go about doing this. I know there are some file hosting services (such as YouSendIt) that offer a limited number of downloads per file. Once that limit has been reached, the file is no longer available to download.

Is there some way that I could "auto delete" this file? Or even set it to not be able to be downloaded more than one time?

Thanks in advance for your help.


04-02-2007, 09:16 PM
Yea, an easy method is the user and an ID I would assume yes? Well when they purchase it or w/e, add it to a row in the db with that users ID and location. Then when that ID downloads that file at that location, delete it :)

EDIT: Obviously only allow access for that ID :p

04-02-2007, 09:25 PM
But that would require me to delete it later on. I was just looking for a simpler way of it deleting itself, or even renaming itself so that it can be downloaded again with the link they are given, then I can delete them later.

The purpose of this is for a security precaution. The script is used for an account list conversion type thing. I want these people to have a safe feeling knowing that I won't be copying their personal account information.

I know I won't copy their information, but sometimes people are skeptical when it comes to these kinds of things. Which may lead them away from the service that I'm providing just because of that.