How to move an image in a plugin to the upload directory and make it as a media of wordpress?

Check out wp_insert_attachment(). Takes an $attachment array of metadata and a $filename and inserts it into the media library. The Codex page has a good snippet so I won’t include one here.

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