upload featured image in custom post type from frontend

You are using the wp_insert_attachment() function, which states the following in the Codex:

This function is part of the low-level API used by WordPress for handling attachments. To perform the entire attachment upload and insertion process at once, you will want to use media_handle_upload() instead in most cases.

So to automatically generate the image resizes and an attachment entry in the database, use the media_handle_upload() function instead.

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