Aha thx so now it is
fname.SetValue(filename)
fName.replace('/','\')
recs = fName.count('..\')
Rootfolder=glo:uncmap&'\HTML_MERGEFILES'
loop recs times
Rootfolder=removelastdir(Rootfolder)
fName.replace('..\','')
end
if img.loadfile(rootfolder&'\'&fname.GetVal())
if img.len() > 0
img.base64Encode(st:noWrap)
replaces=st.replace(tagContents[tagStart+1:tagEnd - 1],'data:image/'&fName.extensionOnly()&';base64,'&img.getValue())
end
end
Procedure removelastdir(IFilePath)
I=Instring('\',IFilePath,-1,Len(IFilePath))
if I>0 ! if there is a \
IFilePath=IFilePath[1:(I-1)]
end
if Instring('\',IFilePath,-1,Len(IFilePath))=0
IFilePath=CLIP(IFilePath) & '\'
end
Return clip(IFilePath)