Reseting the dynamic jpgs and check on error

hey guy need help again.
i have this on my button :

this will load the image that is key in the text field.
any idea i can check an error here like:
if i key in the wrong file name i will get a text say “wrong file name.!”
else if correct file name, load the jpgs…

i have this on my reset button:
this._parent.text1.text= “”;

it will reset wht i wrote on the text field.
but i still need to unload all the pics i have uploaded.

any ideas???