I shamelessly stole this routine from PHP.net:
ob_start();
if (file_exists($WriteFile)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($WriteFile));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($WriteFile));
ob_clean();
flush();
ob_flush();
readfile($WriteFile);
exit;
}
$FileName is set at the beginning of the script.
The routine never calls up a 'save' dialogue. Instead, it writes the contents of the file at the bottom of the script's output. I've got error reporting turned on and there are no errors where the upload code is.