How to check if txt file exists inside template folder?

You are trying to check it by URL, which makes no sense to is_file() which expects local path. By the way I’d use file_exists() instead.

Try:

$fileName1 = TEMPLATEPATH . '/txtfolder/file1.txt';

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)