PHP Listener for Uploaded Files
I am working on a project and am stuck at this part. I am trying to write a script in PHP that will I guess scan my directories on my server. Once a set of files is uploaded to a directory (Probably around 100 files uploaded) I want this script to then perform an event.
I am stuck on the code that will scan my directories while waiting for the files to be uploaded.
The structure of what I am looking for is this:
(Code to scan directories, waiting for files t开发者_StackOverflow社区o be uploaded) -> Once files are uploaded -> Perform this event.
Any help would be greatly appreciated!
Thanks
My server is hosted by Network Solutions if that helps. So I am not sure if I will be able to or have access to start a cron job.
I send you on the way, but I'm not going to write all the code...
Check out this answer for a way to recursive search through a folder structure.
It will be simple to modify to check for new files.
Just set that up in a cron job, or if you don't have access to setup cron jobs, set it up to trigger on every nth page load so that way, as long as you have a decent amount of traffic, it will run regularly.
精彩评论