If it were string it would never work. It would never add an image. But it refuses to add an image only if there is already an image file "ad_title".
Now I'm a little bit further to understanding this problem. It's about namespace order of search. Since the same name "ad_title" is used for both form variable and resulting image, it means a clash. When the image is already there, the "if ad.filename" actually queries the image file in ZODB - because the namespace search order says that ZODB comes before REQUEST.form. And the image file has no attribute called filename. I know two ways to solve it. Change form name, or put images in different folder. I also know how to solve it without renaming of moving images but in pure DTML with Python Script dropped. <dtml-with REQUEST>. However I would be interested to know (for the sake of the argument) if there is a way to solve it without renaming of moving images, and in Python Script. I was trying to qualify ad_title in Python like this: if context.REQUEST.ad_title.filename: or if context.REQUEST['ad_title.filename']: but it would not work. Why? -- Milos Prudek