hi guys,
i am new not only to this forum but to php too. I have allowed the user to upload file n each file name is session id. n i store the filename in $_SESSION variable but when the user signs out or closes their browser, i want php to delete that file which was uploaded.
presently my solution to this problem is:
i run jquery to refresh a div after every 1 mseconds n that div is refering to php file which checks if user has logged out then delete file else dont...
but my bad luck...this is not working...i thought might as well see the experts, can you guys please suggest whether i can do this or not in php.
many thanks in advance
delete file automatically after session ends
Moderator: General Moderators
Re: delete file automatically after session ends
Since the web is stateless, you can't know when a user closes their browser. Why do you need to delete the file? If it is a disk space issue, simply run a clean-up script on a regular basis; it could delete any files that are older than a certain date.