Page 1 of 1

Downloaded wav file is not playable.

Posted: Thu Oct 18, 2007 11:32 am
by srinionline
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hi,

I have problems with downloading .wav files, using php.

I just need to stream the .wav files. (filesize is normally 50 - 150 MB).

I tried the following methods.

Code: Select all

header("Content-type: ".$fType);
header("Content-Transfer-Encoding: binary");
header("Content-length:".filesize($srcTrack));
header("Content-Disposition: attachment;filename=".$fileName);
Method 1:
--------

Code: Select all

$fh		=	fopen($srcTrack, "r") or die("Could not open file!");
$data	=	fread($fh, filesize($srcTrack));
fclose($fh);
echo $data;
Method 2:
--------

Code: Select all

readfile($srcTrack);

Method 3:
--------

Code: Select all

$fp = fopen($srcTrack, "rb");
fpassthru($fp);
In all cases, Im able to stream the .wav file and force the download prompt.
The issue is, im not able to play the downloaded .wav file

Please help me, what im missing.

Thanks in advance, for any help.

Srini


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Re: Downloaded wav file is not playable.

Posted: Thu Oct 18, 2007 2:54 pm
by anjanesh
srinionline wrote: In all cases, Im able to stream the .wav file and force the download prompt.
The issue is, im not able to play the downloaded .wav file
You mean to say that, after download finishes, the wav file is corrupted ?
Or are you talking about playing the wav file within the browser ? If its the latter, you'll need some sort of plugin to handle that file-type.
For example, in FireFox, you would need to check in Tools > Options > Content > Manage to see if what application is associated with it, if any.

Posted: Thu Oct 18, 2007 10:53 pm
by srinionline
No, I dont need to play the file on the browser ...

The user purchases the wav file.

After the download finishes, the .wav file is got corrupted.

Posted: Thu Oct 18, 2007 10:57 pm
by srinionline
I provide both options .... .mp3 and .wav files to download.

I dont have any issues with .mp3 files. (I do the same steps to download mp3 files.)

mp3 files are not corrupted. Only .wav files are corrupted.

One more thing ... the downloaded .wav filesize is as same as the original .wav file's size