Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
Thread: Settings files to expire
04-20-2003, 08:50 PM #1
- Join Date
- Jun 2002
- Thanked 0 Times in 0 Posts
Settings files to expire
If a file in created using fopen, how can I set it so the file will expire, ie. delete itself after a specified amount of days ?\o/
04-20-2003, 10:35 PM #2
- Join Date
- May 2002
- Marion, IA USA
- Thanked 83 Times in 82 Posts
It cannot be done automatically with PHP. You would need to use a CRON job which is basically a linux scheduling program. You can set it up to run every XX seconds/minutes/days etc. It will execute any command you tell it to at that time which can be a shell script or a php script.
CodingForums Supreme Overlord
All Hail Spookster
04-21-2003, 09:53 AM #3
You cannot set an expire, but something I have done before (using a database too), is to get the time when the file was created, and add an ammount of time onto the file. ( say 3600, an hour ), and insert that value into a database, along with the filename.
Providing anyone visits your web page, you check the current time against the time in the db, if the current time is greater, you delete the file with the filename from the db.
If you want more help, post back.