![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
Confirmed User
Join Date: Apr 2004
Location: Montreal
Posts: 799
|
![]() How can I set file to expire by themself ?
I'm creating files in PHP for download but once it has been downloaded I what the file to be destroyed. How can I do that ? Can I put an expiration date like time() + 3600; so the serveur would destroy the file an hour after creation ? Thanks a lot and Happy new year !
__________________
I have nothing to advertise ... yet. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
Confirmed User
Join Date: Feb 2004
Location: Right next to you....
Posts: 1,148
|
add a timestamp to the filename, and when you are creating a new file, see if there are any files that are older than n minutes. if so, delete it.
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
Worker Bee
Join Date: Apr 2003
Posts: 90
|
crontab this hourly
find /path/files/are/in/ -type f -mmin +60 -print replace the -print with -delete AFTER YOU HAVE VERIFIED it finds the right files to delete. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 |
Confirmed User
Join Date: Apr 2004
Location: Montreal
Posts: 799
|
thank you guys.
Do you know if the tmpfile function in PHP use the memory to create the file or does it write it on the HD ? This could fix my problem...
__________________
I have nothing to advertise ... yet. |
![]() |
![]() ![]() ![]() ![]() ![]() |