How to check if there is an image with the same file name?