This is my code to store audio from Android app to server and database
include("db.php");
$uid=$_POST['uid'];
$meeting_id=$_POST['meeting_id'];
if(!is_dir("audioupload/".$uid."/".$_SESSION["uid"]."/"))
{
mkdir("audioupload/".$uid."/".$_SESSION["uid"]."/");
}
$info = pathinfo($_FILES['audio']['name']);
$ext = $info['extension'];
$audio_name = "meeting_id".$meeting_id.".".$ext;
if(move_uploaded_file($_FILES["audio"]["tmp_name"], "audioupload/".$uid."/".$_SESSION["uid"] ."/". $audio_name))
{
echo "File uploaded Successfully";
} else
{
echo "File was not uploaded";
}
$sql="INSERT INTO `audio`(`uid`,`meeting_id`,`audio`) VALUES ('".$uid."','".$meeting_id."','".$audio_name."')";
$result1 = mysqli_query($conn,$sql);
This code is working fine. I'm able to store audios of particular user in their particular directories.
What I actually want that display this audio on front end
<td><audio id="audio" autoplay controls src="<?php echo $row_audio['audio'];?>" type="audio/mpeg"></audio></td>
This is what I'm using for fetch records, a simple while loop with php fetch_assoc
I get this basic response from database
How will I get audios that I store in server?