Re: Newbie: function for downloading

From: Date: Sun, 03 Feb 2002 01:28:34 +0000
Subject: Re: Newbie: function for downloading
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-83274@lists.php.net to get a copy of this message
"Manuel Ritsch" <chraensch_mc@gmx.ch> wrote in message news:20020201180127.18941.qmail@pb1.pair.com... > Hey There > > I have a little question > > I'm making a page where you can download mp3's (hip hop and funk beats made > by myself) and i want, if you press on the > link (<a href="yadayada.mp3">), that it doesn't start an internal audio > player (like some configurations/browsers do), rather i want that the > download dialog (like when you download .exe or .zip files) appears to save > the mp3 on your harddisk, can anyone give me a tip? > > Greets > -- manu > Take a look at http://www.php.net/header, particularly the Content-Disposition portion of it: << If you want the user to be prompted to save the data you are sending, such as a generated PDF file, you can use the Content-Disposition header to supply a recommended filename and force the browser to display the save dialog. <?php header("Content-type: application/pdf"); header("Content-Disposition: attachment; filename=downloaded.pdf"); /* ... output pdf file ... */ Note: There is a bug in Microsoft Internet Explorer 4.01 that prevents this from working. There is no workaround. There is also a bug in Microsoft Internet Explorer 5.5 that interferes with this, which can be resolved by upgrading to Service Pack 2 or later. >> You'll need to choose the correct content-type and filename of course.

« previous php.general (#83274) next »