I have a folder called pdf where user will upload pdf's in it,i want a php script which will run for every five minutes to read the pdf folder in order to check for the newly added files in that folder?and intimate to the admin that few files with the following file names are added,how can i do that using php
1 Answer
php scripts cannot auto execute it only execute if there is request made to them..
a simple idea in your case could pe
1.write a php function with the logic to see if filesystem has changed and do the necessary
action(email/database update) on execution.
- place & call this function on your home page(index.php).
3 Comments
Pinoniq
you can have cronjobs to automate execution
Ashish
it's not possible with every hosting provider so i will not suggest it a fullproof method
Pinoniq
True, but including in the index.php onevery request is bad. Use a little javascript that calls your 'cron.php' async. Just like drupal does it. this willl make sure that your users accessing your site do not notice a performance difference