In case you are interested, the mistake was well down on the page in a block where I was testing to see if the upload email had been sent and it was this bit of code -
<? } ?>
Note the missing "php" in the opening php tag! Wonder why that wouldn't show up as an error on the page! Anyhow, it's working now. Thanks again.