Saving frontend form data in wordpress

Also, how are you processing your image upload? That function only sets the enctype.

By adding the following beneath your call to wp_insert_post you will be able to process your image upload,

if (!function_exists('wp_generate_attachment_metadata')){
    require_once(ABSPATH . "wp-admin" . '/includes/image.php');
    require_once(ABSPATH . "wp-admin" . '/includes/file.php');
    require_once(ABSPATH . "wp-admin" . '/includes/media.php');
}
     if ($_FILES) {
        foreach ($_FILES as $file => $array) {
            if ($_FILES[$file]['error'] !== UPLOAD_ERR_OK) {
                return "upload error : " . $_FILES[$file]['error'];
            }
            $attach_id = media_handle_upload( $file, $pid );
            add_post_meta($pid, 'meta_key_to_attach_image_to', $attach_id, false);
            continue;

        if ($attach_id > 0){
            //and if you want to set that image as Post  then use:
            update_post_meta($pid,'_thumbnail_id',$attach_id);

        }
    }
}

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