RE: [PHP] left click downloads

From: Date: Wed, 13 Nov 2002 08:58:21 +0000
Subject: RE: [PHP] left click downloads
Groups: php.general 
Request: Send a blank email to php-general+get-124186@lists.php.net to get a copy of this message
here is a simple function I have created to do single click downloads in php - function sendFile($filepath) { $filename = basename($filepath); $mimeType = mime_content_type($filepath) header("Content-type: $mimeType"); header("Content-Disposition: attachment; filename=$filename"); readfile($filepath); } In Unix can anyone post a method of obtaining mimeType using the file command which could be compatible with this function? I guess this is possible... my understanding is that mime_content_type() is based on unix file commands method of pattern matching 'magic bytes' of known file formats. hope this is useful to some of you... javier
From: "David Russell" <DavidR@BarloworldOptimus.com> To: "'Javier Montserat'" <codareef@hotmail.com> Subject: RE: [PHP] left click downloads Date: Tue, 12 Nov 2002 13:46:58 +0200 Hi Javier, Nope, this is not a php thing at all. You could probably get it right with Javascript or something similar. HTH David Russell IT Support Manager Barloworld Optimus (Pty) Ltd Tel: +2711 444-7250 Fax: +2711 444-7256 e-mail: DavidR@BarloworldOptimus.com web: www.BarloworldOptimus.com -----Original Message----- From: Javier Montserat [mailto:codareef@hotmail.com] Sent: 12 November 2002 01:24 PM To: php-general@lists.php.net Subject: [PHP] left click downloads I want to make it easier for people to download files from my website by having the download start when the visitor clicks a link (as opposed to right click / save target as). How can I achieve this with PHP? Do I include the file in a header() call ? Thanks, javier _________________________________________________________________ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php << smime.p7s >>
_________________________________________________________________ MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. http://join.msn.com/?page=features/virus

« previous php.general (#124186) next »