basically once the file is selected from the browse button and upload is pressed, I need the php to upload the file, calculate how long the sound file is time wise.
for instance if test.wav is uploaded the script can tell how long the sound file is time wise
ex: test.wav = 42 seconds
how do I do this?
also once the file is uploaded I need it to refresh(getbyelementid) with a time showing and a dropdownbox of the file(s)...I am going to use ajax for this.
here is the current upload php script.
Code: Select all
<?php
include 'vdattcon.php';
$userid = $_POST["userid"];
$target_path = "/var/lib/asterisk/sounds/";
$backup_path = "/srv/www/htdocs/k2zwf6jks9yx6zhs6vr06842jj51fx/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
$backup_path .= basename( $_FILES['uploadedfile']['name']);
$filename = $_FILES['uploadedfile']['name'];
if (copy($_FILES['uploadedfile']['tmp_name'], $target_path) && copy($_FILES['uploadedfile']['tmp_name'], $backup_path)) {
echo "The file ". basename( $_FILES['uploadedfile']['name']).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
//a. connect to audio att table db
$connatt = mysql_connect($atthost, $attuser, $attpass) or die ('Error connecting to mysql audioatt');
mysql_select_db($attname);
//b. Connect insert filename in table
$resultuid = mysql_query("INSERT INTO audioatt VALUES (
'$uuuid',
'$userid',
'$filename'
)");
?>