I am trying use this example http://www.sajithmr.me/jrecorder/example2.html for recording audio and send it to my localhost server, but I have issue here. My code describe below
<script>
$.jRecorder(
{
host : 'http://localhost/Jrec/html/acceptfile.php?filename=hello.wav',
callback_started_recording: function(){callback_started(); },
callback_stopped_recording: function(){callback_stopped(); },
callback_activityLevel: function(level){callback_activityLevel(level); },
callback_activityTime: function(time){callback_activityTime(time); },
callback_finished_sending: function(time){ callback_finished_sending() },
swf_path : 'jRecorder.swf',
}
);
</script>
this my acceptfile.php
if(!isset($_REQUEST['filename']))
{
exit('No file');
}
$upload_path = dirname(__FILE__). '/';
$filename = $_REQUEST['filename'];
$fp = fopen($upload_path."/".$filename.".wav", "wb");
fwrite($fp, file_get_contents('php://input'));
fclose($fp);
exit('done');
whalt should I do with $upload_path = dirname(FILE). ‘/;?
when I press send data button the file doesn’t upload into following directory (“files”). What is the problem here, Any help will be apriciated
it works like Shikiryu and seth flowers said. But remember to remove .wav from filename because it adds the extension .wav here:
$fp = fopen($upload_path."/".$filename.".wav", "wb");