Hi, i have a script that process a file that is sent from a macro to a directory.
then from the server i open the web interface, where i open the file and process it.
I'm wondering if there is a way with PHP to run the script when the file arrive to the directory automatically. Of course after the file is read it must be deleted...
Thanks for your hints...
Can PHP process a file automatically?
Moderator: General Moderators
-
malcolmboston
- DevNet Resident
- Posts: 1826
- Joined: Tue Nov 18, 2003 1:09 pm
- Location: Middlesbrough, UK
Re: Can PHP process a file automatically?
Doing something like this, imo anyway, would require a real-time directory analyzer at OS level, which PHP simply doesnt have access to.paolone wrote: I'm wondering if there is a way with PHP to run the script when the file arrive to the directory automatically. Of course after the file is read it must be deleted...
Thanks for your hints...
PHP's execution is execution-based, meaning the code only parses when the file has been executed (loaded into browser etc) something like this would require PHP to have real-time actions which it simply doesnt.
Something like C is perfect for this
Ok, thank you...
But if i got it well, i could run a command on the server where the file is hosted and run the script to process the file, right?
Doing so, i will have a command running that will save a file on the directory, and then another that will run after this, to execute the file (let's say) 'monitoring.php'.This will be opened in the browser window and will be executed...
But how can i scan a directory to retrive the file name?
Using 'file_exits', and then?
But if i got it well, i could run a command on the server where the file is hosted and run the script to process the file, right?
Doing so, i will have a command running that will save a file on the directory, and then another that will run after this, to execute the file (let's say) 'monitoring.php'.This will be opened in the browser window and will be executed...
But how can i scan a directory to retrive the file name?
Using 'file_exits', and then?
- n00b Saibot
- DevNet Resident
- Posts: 1452
- Joined: Fri Dec 24, 2004 2:59 am
- Location: Lucknow, UP, India
- Contact: