I'd like to send a notification e-mail each time a file was successfully transferred to or deleted from a specific folder via FTP (FileZilla). How do I realize that? As the files aren't transferred via PHP, the function *is_uploaded_file* seems to be not an option, does it?
Asked
Active
Viewed 860 times
1
-
do you want to send the email from filezella or from your server? – Mar 04 '13 at 19:34
-
From the server via PHP function *mail*. – Ben Mar 04 '13 at 19:54
-
how about a cronjob checking the directory every 10 minutes – Mar 04 '13 at 19:55
-
@Dagon: With *scandir* and *array_diff*? But how to distinguish if a file is transferred completely? – Ben Mar 04 '13 at 20:01
-
@hek2mgl: Linux. But I don't have shell access. – Ben Mar 04 '13 at 20:01
-
@Ben Ok. Then you are searching for a php solution. Note with (just) PHP and without shell access, I see no reliable solution. Normally one would use [inotify](http://en.wikipedia.org/wiki/Inotify) for that. A more or less the same mechanism of directory watching is possible on Windows (don't know api name, but having once done) – hek2mgl Mar 04 '13 at 20:07
-
maybe you should switch to doing it with php – Mar 04 '13 at 20:12
-
You could execute the check for changes in the FTP folder on each request, yes. But if there are no requests, we have a problem. Possible solution would be to trigger the request periodically from another machine. Then the frequency would be regulary once per minute. If this is ok for you it might be your solution. But it's really hacky and fragile ;) – hek2mgl Mar 04 '13 at 20:22
-
possible duplicate of [Fastest way to compare directory state, or hashing for fun and profit](http://stackoverflow.com/questions/4343868/fastest-way-to-compare-directory-state-or-hashing-for-fun-and-profit) – Gordon Mar 06 '13 at 17:51