Perform Action on File Copy


I have a tricky problem hopefully someone can help me with.

Basically I’m using a fairly isolated system that uses a basic upload and just moves it to a location on that server.

The problem is, that server is fairly tiny (harddisk-wise), so I want to move them off of that.

Is there any way that when a file is uploaded to a specific location I can run this file through another script (preferably PHP, but I can use just about anything) to push it up where I want.

The place I want isn’t accessible via fopen() or FTP, I have to use a specific API.

Worst-case scenario I could create a processing script which is run every so often, but that’s kind of inefficient.


Have a look at “incron”, that’s like a “cronjob” for file “actions” (create, rename, delete etc.).
It watches a filesystem tree and can trigger a script to take further action depending on the file action performed.


I think I’ve decided to go a different route, but I’ll look into that for future use.