Jump to content

how to play wav file which is stored outside webroot directory


php1

Recommended Posts

Dear all,

Is there any way to play a wav file which is stored outside webroot directory.

my webroot directory is : /var/www/html

my wav file is stored in : /var/spool/wav/play.wav

 

I have used passthru function but the file is not playing.

my code is

<?php

passthru("/var/spool/wav/play.wav", $err);

echo $err;

?>

but $err is 0. No error I think. But file is not playing.

 

Isthere any way to play a wav file which is stored outside the webroot directory

 

to start off, the $err variable is undefined in that script.

try creating your link are a variable like;

 

<?php
$filename = "/var/spool/wav/play.wav";
passthru($filename.$err);
echo $err;
?>

 

passthru() is disabled on my servers for some reason so I can't test that for you, but hope it helps.

I want to play the wav file.

when i use embed tag like below the problem is that the page is not loading completly.

<html>

<body>

<embed src="play.wav"

width=0 height=0 autostart=true repeat=true loop=true> </embed>

</body>

</html>

 

when i give like below ie when giving absolute path, a blank page is coming

 

<html>

<body>

<embed src="/var/www/html/CallMonitor/play.wav"

width=0 height=0 autostart=true repeat=true loop=true> </embed>

</body>

</html>

 

is there any api using which we can play the audio file

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.