Get post attachment with post id

yes
use this code here you can get attachment id

if(isset($_FILES['myimage']) && ($_FILES['myimage']['size'] > 0)) {
// Get the type of the uploaded file. This is returned as "type/extension"
$arr_file_type = wp_check_filetype(basename($_FILES['myimage']['name']));
$uploaded_file_type = $arr_file_type['type'];
// Set an array containing a list of acceptable formats
$allowed_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png');
if (in_array($uploaded_file_type, $allowed_file_types)) {
    $upload_overrides = array('test_form' => false);
     $uploaded_file = wp_handle_upload($_FILES['myimage'], $upload_overrides);
    if (isset($uploaded_file['file'])) {
        $file_name_and_location = $uploaded_file['file'];
        $file_title_for_media_library = $imagetitle;
        $attachment = array(
            'post_mime_type' => $uploaded_file_type,
            'post_title' => 'Uploaded image ' . addslashes($file_title_for_media_library),
            'post_content' => '',
            'post_status' => 'inherit'
        );
        // Run the wp_insert_attachment function. This adds the file to the media library and generates the thumbnails. If you wanted to attch this image to a post, you could pass the post id as a third param
        $attach_id = wp_insert_attachment($attachment, $file_name_and_location);//here you get attachment id
        require_once(ABSPATH . "wp-admin" . '/includes/image.php');
        $attach_data = wp_generate_attachment_metadata($attach_id, $file_name_and_location);
        wp_update_attachment_metadata($attach_id, $attach_data);
        update_post_meta($post_id, 'pluginimage', $attach_id);//update post data by attachment id
        $upload_feedback = false;
    }
}}