Checking if an image file exists before assign its URL to a control

I’m looking for some hints or tips on how to check, from my Natural program (mainframe side), if an image file (BPM, JPG, PNG, GIF etc.) exists in its file system (e.g., at the Application Server location, mapped to Natural for AJAX as: “…/images/ICON.png”), before to assign its URL to a Natural for AJAX control as IMAGE.
By this way, I can assign a default image to this control when its correspondent image was not found.

You can use REQUEST DOCUMENT with an url to your application server. The url can be the same you can find later on at your generated html. If the picture is available you should get a 200 response. Using an HEAD request (no RETURN PAGE specified - see documentation) instead of GET/POST no big data should be transfered.
… may it’s little bit crazy doing it this way, but it should work …

Hi Eric,

Thank you for your suggestion: it worked perfectly!

Now I just need to know how to get the full address of the image URL (with the HTTP: “http://server-name/cisnatural/images/ICON.pgn”), since I only have the relative address: '… /images/ICON.pgn and the REQUEST DOCUMENT statement requires the full address…

Regards and thanks again,