Log in

View Full Version : On the Handling of Filetypes in Browsers, and the Overriding of Such



ukvet
01-31-2009, 12:34 AM
Hi everyone, I’m new using HTML and was wondering if I can create a link, like DOWNLOAD have the download window come up to download .mp3 / .wav files ….

Thanks for any help …..

Twey
01-31-2009, 01:01 AM
Yes, you can.

jscheuer1
01-31-2009, 02:33 AM
Yes, you can.

Twey, Twey! . . . I think they were asking how. Do you know? I sure don't, not offhand, as generally the browser will do as it is configured with a link to an audio file, generally out of the control of the web designer, generally it will play the file, not launch a download dialogue.

Twey
01-31-2009, 03:38 AM
Twey, Twey! . . . I think they were asking how. Do you know?Indeed I do! At least insofar as such a thing is possible.

However, things like server configuration are relevant. I have to say that this is possibly the most unhelpful topic title I have ever seen, and I was torn between just changing it and giving a reply in the same vein. I think the latter option won. :)

jscheuer1
01-31-2009, 04:21 AM
Indeed I do! At least insofar as such a thing is possible.

I have to say that this is possibly the most unhelpful topic title I have ever seen

'Nuff said. I do the same sort of thing at times. I didn't realize that you had edited the title. The original post itself was, well - weird, to say the least.

Anyways, the simple answer (using just HTML) is to archive the audio file as a .zip file. Most browsers will launch a download dialogue for that.

You could have (still can) move the thread to a more appropriate forum though.

If you do, feel free to edit/delete my contributions so far.

Snookerman
01-31-2009, 09:26 AM
@ukvet - Take a look at this article:
http://classicasp.aspfaq.com/general/how-do-i-prompt-a-save-as-dialog-for-an-accepted-mime-type.html (http://classicasp.aspfaq.com/general/how-do-i-prompt-a-save-as-dialog-for-an-accepted-mime-type.html)

Good luck!

@Twey - You made me curious now, what was the thread title? I'm guessing something like "Can I?"

Twey
01-31-2009, 03:29 PM
No, it was 'ukvet'.

Snookerman
01-31-2009, 03:34 PM
No, it was 'ukvet'.
:D "Can I?" was the least descriptive I could think of, but that beats it by miles.

jscheuer1
01-31-2009, 04:03 PM
@ukvet - Take a look at this article:
http://classicasp.aspfaq.com/general/how-do-i-prompt-a-save-as-dialog-for-an-accepted-mime-type.html (http://classicasp.aspfaq.com/general/how-do-i-prompt-a-save-as-dialog-for-an-accepted-mime-type.html)

Sounds complicated, can you do that in PHP?

Snookerman
01-31-2009, 04:33 PM
Sounds complicated, can you do that in PHP?
I don't know, but if it is possible, it's beyond my capabilities, I'm still in the learning stages of PHP.

Twey
01-31-2009, 07:42 PM
Line-for-line, mostly:
<?php
header('Content-Type: application/x-unknown'); // arbitrary
$fn = 'whatever.jpg';
$fpath = 'c:\' . $fn;
header('Content-Disposition: attachment; filename=' . $fn);
readfile($fpath);
?>

jscheuer1
01-31-2009, 09:34 PM
Is:



'c:\'

the path on the server, or the default path on the client suggested for a download folder?

Twey
01-31-2009, 10:00 PM
The path on the server.