video is uploaded to the sever but not into the database

Hey guys im trying to upload videos on my website but some videos work mostly small videos but when uploading large videos it will upload it but it wont insert it into the db any idea why?

    if(isset($_POST["Upload-Video"])) {
        $getID3 = new getID3;
        $target_dir = "category/videos-images/";
        
        $video_name = $_POST["title"];
        $video_description = $_POST["description"];
        $video_category_id = $_POST["category"];
        $video_md5_name = convert_file_name("image");
        $video_duration = get_file_duration("image", $getID3);
        
        empty_file_inputs($video_name, $video_description, $_FILES, $video_category_id);
        
        if(file_exists("$target_dir/$video_md5_name")) {
            die(header("location: ../admin.php?error=file exists"));
        } else {
            insert_video_to_database($conn, $video_name, $video_description, $video_duration, $video_md5_name, $video_category_id);
            move_uploaded_file($_FILES["image"]["tmp_name"],"$target_dir/$video_md5_name");
            wait_file_upload($target_dir, $video_md5_name);
            echo "Uploaded.";
           }

    } 

the insert_video_to_database() works fine if i use small video but for some reasons if i use a large video it will upload it to the videos folder but not insert it into the db why is that? i tried adding the insert before the upload and after the upload didnt work i have no idea why