/    Sign up×
Community /Pin to ProfileBookmark

how to download a wav file in html?

Hi friends,

When a link is clicked, i should be able to download the wav file…I know it can be done by right click, save target…and also by zipping wav file…but that is not my aim..How can this be done? Is there any scripts?….Please guide

Thanks in advance…
Prasad

to post a comment
HTML

4 Comments(s)

Copy linkTweet thisAlerts:
@opifexOct 14.2009 — Do you want ALL wav files to down load or just certain ones?

To force all .wav to down load you can use .htaccess[CODE]<FilesMatch ".(?i:wav)$">
ForceType application/octet-stream
Header set Content-Disposition attachment
</FilesMatch>[/CODE]

-------------------------------------------

to pick and choose you can use this snippet[code=php]
<?php
$file = $_GET['file'];
header ("Content-type: octet/stream");
header ("Content-disposition: attachment; filename=".$file.";");
header("Content-Length: ".filesize($file));
readfile($file);
exit;
?>[/code]

and make your link like this[code=html]<a href="forcedownload.php?file=sound.wav">Download WAV file</a>[/code]
Copy linkTweet thisAlerts:
@PrasadsmauthorOct 15.2009 — Hi Opifex,

Thanks for your reply.

Actually i am using IIS, So i can't get .htaccess file.

The only possibilty is that I have to use php script which you have sent. But how can I include that php script in html? ?

Thanks,

Prasad
Copy linkTweet thisAlerts:
@opifexOct 15.2009 — save the snippet as forcedownload.php.

Hopefully you have PHP installed on the server! if not, try asking again in the ASP forum... the solution would be similar, but the syntax is different.

I always wonder why people would want to use Windows servers when the quality and flexibility of any NIX server with Apache server readily available.
Copy linkTweet thisAlerts:
@PrasadsmauthorOct 15.2009 — thanks for your suggesstion...i will try in asp forum?
×

Success!

Help @Prasadsm spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...