Page 1 of 1
Can PHP process a file automatically?
Posted: Fri May 20, 2005 3:13 am
by paolone
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...
Re: Can PHP process a file automatically?
Posted: Fri May 20, 2005 3:22 am
by malcolmboston
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...
Doing something like this, imo anyway, would require a real-time directory analyzer at OS level, which PHP simply doesnt have access to.
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
Posted: Fri May 20, 2005 3:42 am
by paolone
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?
Posted: Fri May 20, 2005 5:45 am
by n00b Saibot