By lapurda on
HI
Download a wave file by using drupal ,I am writing the code for downloading a wave file but it does not play
my code is like
function download()
{
$directory = /path1/path2/path3/path4/;
$filename ="msg0000.wav";
$wavefile="msg0000.wav";
$path = "$directory$filename";
if( file_exists($path) AND substr_count($filename,"/") == "0")
{
header("Content-type :audio/x-wav");
header("Content-Disposition: attachment; filename=$wavefile");
header("Content-Length: ".filesize($path));
readfile("$path");
echo "Download notification";
}
else
{
echo "Download error";
}
}
I am writing this code in file that file is present in /home1/home2/home3/file.php
It download a file but there is no content so that the downloaded file cannot play .
This is my problem ,please help me.