Yes, unfortunatley you can't use XMLHttpRequest to upload a file fro the users computer.
The reason is that JavaScript does not have access to the file contents. It only has access to the file name, once the user has selected a file to upload. This is a security feature.
The actual upload of files, is completely done by the browser, and is not in the control of client side scripting.
Unfortunately PHP (without special extensions) cannot control the upload of the file into the sever either. This is why creating and upload progress monitor in PHP is difficult under default settings.
Taking that into account. Your choices in uploading files from browser to PHP without refreshing the page are:
1) Use an Iframe to upload the file
2) Use a client side plugin, such as Flash or Java
The first is probably the simplest, and more cross browser compatible.
So following that example I could upload the file, and I'd have all the information from the form, in the PHP, and I could synchronize the upload and the insert, but then I can't figure out how to send the OK from the PHP to a Javascript (i guess) to update the html and display the message in the web site. And anyway, is this the right approach to do what I need?
You'll need a way for the IFRAME to send a message to the parent page. From the Iframe you can reference the parent window's
window object using:
window.parent
A simple example is:
// inside iframe
window.parent.document.write('hi');
This will write "hi" in the parent window.
So you can use the same to invoke any other function. eg:
// inside iframe
window.parent.uploadDone(true);
So when your PHP page finishes writing the upload file, you could send back a page with the JS:
echo '<script>window.parent.uploadDone(true);</script>';
This will let the parent know the status of the upload.