damijim
asked on
PHP Header Function Attempt to Play WAV in Browser
Hello,
I have some headers that I use to send a wav file to the end-users browser. Is there a way to make it attempt to play in the wav in the user's web browser rather than the "Save/Open/Cancel" dialog box? I've attached my header code. Thanks!
I have some headers that I use to send a wav file to the end-users browser. Is there a way to make it attempt to play in the wav in the user's web browser rather than the "Save/Open/Cancel" dialog box? I've attached my header code. Thanks!
//send the wav to client via headers
$size = filesize("tmp/$random_string.wav");
header("Content-Type: audio/wav", TRUE);
header("Content-Disposition: ATTACHMENT; FILENAME=\"" . $random_string . ".wav\"", TRUE);
header("Content-Length: " . $size);
header("Content-Transfer-Encoding: binary");
//open, send file, and close connection, delete (unlink) the tmp file.
$fh = fopen("tmp/$random_string.wav", "r");
fpassthru($fh);
fclose($fh);
unlink("tmp/" . $random_string . ".wav");
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Yes, thats correct.
ASKER
Thank you!
ASKER
ASKER