Forum Moderators: phranque

Message Too Old, No Replies

Methods for Downloading MP3 Files

Looking for a one-click solution for downloading MP3s

         

gballast

5:21 pm on Aug 2, 2002 (gmt 0)

10+ Year Member



Hi,
I'm trying to find out if there is a way to set up MP3 files so that users get an option to "save to disk" automatically, without providing instructions for the right-click "save target as" method. Any suggestions/procedures for setting this up would be greatly appreciated. Thanks.
-g

threecrans

10:44 pm on Aug 4, 2002 (gmt 0)

10+ Year Member



I guess the concern with linking to the file like so

<a href="file.mp3">download</a>

would instead cause the file to open in the default audio utility?
If this is the case, there are certainly some other ways to "force" a download, depending on your environment. For example, if you were using ASP, you could use the ADODB.Stream object (included in ADO 2.5) to read the mp3 file from the server's file system. Then you could use Response.BinaryWrite to write the data to the HTTP response. Something like the following code _should_ work.

<%
Set strm = Server.CreateObject("ADODB.Stream")
strm.Open
strm.Type = 1
strm.LoadFromFile "C:\Files\File1.mp3"

'Setting this HTTP header opens the "Save As" dialog box.
Response.ContentType = "application/octet-stream"
Response.BinaryWrite objStream.Read

objStream.Close
Set objStream = Nothing
%>

gballast

7:09 pm on Aug 6, 2002 (gmt 0)

10+ Year Member



Thanks very much for your reply threecans. This is a lot of help. :-)
-g

Sinner_G

6:34 am on Aug 7, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Don't know if that is an option for you gballast, but just packing the mp3 into a zip file would also do the job. And make the download faster.

gballast

4:22 pm on Aug 7, 2002 (gmt 0)

10+ Year Member



Thanks Sinner_G. The zip option is one I considered, and recommended to my client. As you mentioned, the download time would be greatly reduced. It's an option I'm still trying to talk him into :).
gballast