开发者

FTP incoming monitor (on upload)

We have a few 100 users logging in via FTP and uploading files. Our online system (PHP) should display items that have just been uploaded. I don't want to keep checking all the different FTP folders to check for new files.

What is the best way to check for new files with PHP without slowing down the server? All the users have files in folders for example, /uploads/user1, /uploads/user2, etc. The approach I have in mind is the following:

  • Constantly check uploads folder to check if the folder modification dat开发者_StackOverflow社区e has changed (if the date has changed from last time, a file has come in). What PHP function can I use to check upload directory last modified date/time?
  • If above date modified has changed, Use scandir() to go through each directory to pickup directory that has changed to identify files.


Enable logging in your FTP server, and parse the log, usually /var/log/xferlog . FTP servers usually use a format like this.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜