1

I need to determind when a file has been uploaded via an ftp account so i can parse the data and insert into a db.

I could do this 2 different ways, either set up a schedule or watch the directory for any change. Either option would be fine.

I'm new to the apache /php space so any keywords that i can search upon would be handy.

Thanks.

1
  • more proper title would've been: ... with ftp using apache / php Commented Jun 18, 2010 at 9:19

4 Answers 4

1

You would have to set up a server-side cron job to trigger a PHP file that makes the check frequently. On Linux the tool is called cron, on Windows at. If you're on shared hosting, you will need to check whether it's supported: It will most likely turn up in your control panel software if it is.

Watching the directory would require hooking into the FTP server software, or installing a file system watcher. Both things are possible but very much depend on your server environment (and require root access to the server).

Sign up to request clarification or add additional context in comments.

Comments

0

Ideally you will need a cron job. Here is a good description of cron and short tutorial.

Comments

0

You could do this using a cron job and any language you like, really.

Cron is a time-based job scheduler in Unix-like computer operating systems (Wikipedia)

Just have a directory which gets filled with files which need to be processed, then process them and remove them on a regular basis. You could have this job run every five minutes or whenever you like, depending on how time sensitive these files are.

Comments

0

I would suggest to check if the file is there, then before processing, move/rename it (filename_[somethingunique]) so that only the current session will access the file.

Otherwise you may end up 2 scripts inserting same data.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.