Helmut, that seems to be not a good idea.
When i try your code on a field with substituted attachment names, after execution the http server gets ill:
This occurs after that on ALL xpages, regardless if they are involved or not. I have to do a restart of the http-task.
On a field with original attachment names, there is no problem.