如何将数据URI转换为文件并将其保存到目录

I have a code here that converts audio record blob(not a file) into dataURI, i am able to save the dataURI in the database, but i want to get the file created and save it to directory maybe if i can use the move_uploaded_file() in php?

//insert_chat.php
<?php   
$file1 = $_FILES['audio_data']['tmp_name'];
$audioType = pathinfo($file1, PATHINFO_EXTENSION);                      
$data = file_get_contents($file1);
$dataURI = 'data:audio/mp3;base64,' . base64_encode($data);
$date = date("Y-m-d H:i:s");
$data = array(
 ':to_user_id'  => $_POST['to_user_id'],
 ':from_user_id'  => $_SESSION['user_id'],
 ':chat_message'  => $_POST['chat_message'],
 ':timestamp' => date("Y-m-d H:i:s"),
 ':status'   => '1',
 ':audio' => 'yes',
 ':audio_name' => $dataURI
);

$query = "INSERT INTO chat_message (to_user_id, from_user_id, chat_message, 
timestamp, status, audio, audio_name) VALUES (:to_user_id, :from_user_id, 
:chat_message, :timestamp, :status, :audio, :audio_name)";

$statement = $connect->prepare($query);
?>

Here is my java script code, on how i pass the datas to php

function createDownloadLink(blob) {

    var url = URL.createObjectURL(blob);

    var filename = new Date().toISOString();
    var xhr=new XMLHttpRequest();
    xhr.onload=function(e) {
        if(this.readyState === 4) {
            var res = this.responseText;
            var binary = convertDataURIToBinary(res);
            var blob2 = binary;
            var file = new File([blob2], filename, {type: 'audio/mp3', 
            lastModified: Date.now()});
        }
    };

    var fd=new FormData();
    fd.append("audio_data",blob, filename);
    fd.append("to_user_id",userId);
    fd.append("chat_message",filename);
    xhr.open("POST","insert_chat.php",true);
    xhr.send(fd);

}