Code for uploading and previewing an audio file?
Posted: Mon Jun 08, 2009 9:26 am
does anyone know where i might find a good tutorial on uploading and previewing an audio file.
i need to somehow keep the file in the database not sure if this is possible, i have never attempted anyhing like this before so i would love any help or advice on the topic.
so far i have written this code (not a lot but gives you the idea of what i am trying to achieve)
Thanks for your help in advance,
Dave
i need to somehow keep the file in the database not sure if this is possible, i have never attempted anyhing like this before so i would love any help or advice on the topic.
so far i have written this code (not a lot but gives you the idea of what i am trying to achieve)
Code: Select all
<?php
if (isset($_POST['uploadBtn']))
{
//save the mp3 or wav to the database
}
if (isset($_POST['playBtn']))
{
//play back the audio file that has just been uploaded
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Play some Audio</title>
</head>
<body>
<div style="margin:auto; width:50%;">
<fieldset style="border:1px solid #7f9db9;">
<legend>Upload Audio</legend>
<input name="uploadBtn" type="file" />
<input name="playBtn" value="Play" type="button" />
</fieldset>
</div>
</body>
</html>
Dave