I'm working on a PHP web interface that a visitor can use to upload a data file, which then will get processed by script on the server side to read the client data and load it into a MySQL table.

Unfortunately due to the format of the file, the script that processes the file once it is uploaded will have to be run on the server; otherwise the PHP script times out. Right now, I have a cron job set up to run the file processing script (which is in PHP via the command line every 5 minutes, which tests for the existence of the file and processes it when it's available. When the file is processed, the server sends an e-mail message to the user. This is not an optimal solution in my opinion, but it will work for my needs.

Now, my question is this: can I use JavaScript/Ajax to trigger the script on the server when the file is uploaded, check for the completion of the script at regular intervals and update the browser window when the script is complete? I can modify the script to create a small text file on the server with a completion message in it if that is needed for the JavaScript to work.

I'm fairly proficient at PHP, but totally green at JavaScript (although I can usually figure enough out to take examples and modify them for my needs).

Any assistance here would be great. Thanks for your help!