Perfect! I've now got it working dynamically so images are uploaded to a folder (name) based on a unique record accession number.
I placed this code between the recordsets and the WA Update Record SB:
<?php // setup dynamic folder for images in HTML Editor
$original = array(' ', '&', ',', '/');
$replace = array('', 'and', '', '');
<?php $testpath=str_replace($original, $replace, strtolower($row_rsCaseDetail['accession_no'])); ?>
Then in the HTML Editor instance:
It creates the folder if it does not exist.
I could have used a regex for stripping any unwanted characters, but this code works.
On a roll!