RE: [PHP] Download manager

From: Date: Mon, 03 May 2004 12:43:05 +0000
Subject: RE: [PHP] Download manager
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-185190@lists.php.net to get a copy of this message
Hi, I had created an application similar to one you need, It was something like this 1) The path to the original file was stored in an XML <content> <linktitle>AAAAA</linktitle> <subtitle>New Sub Title</subtitle> <filename>Contents/aaaaa.html</filename> <windowtype>NEW</windowtype> </content> 2) While giving link to the file which is to be download, a) it was given as <a href="dispfile.php?QsFName=Contents/aaaaa.html">AAAAA</a> b) In the file dispfile.php, it used to replace "Contents" with the path which I had stored in a common include file. c) Then with the help of Headers I used to display the file contents or allowed user to download the file. 3) Follow. given is some code from dispfile.php, which actually allows to download, $sFName=trim($_GET["QsFName"]); /***** get File Extension ****/ $sFExt=split("\.",$sFName); $sFileExt=$sFExt[1]; if(trim($sFileExt)!="htm" && trim($sFileExt)!="html") { header("Content-Disposition: filename="."\"".$sFName."\""); header("Content-type: application/octet-stream"); } if($sFileExt=="lzh" || $sFileExt=="ppt") header("Content-Transfer-Encoding: base64"); header("Content-type: application/octet-stream"); $sFName=$sContents.$sFName; header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); readfile($sFName); exit(); Hope this will help you. I would be very greatful, if I could do more for you. Regards, Umesh. -----Original Message----- From: Phpu [mailto:phpu@go.ro] Sent: Monday, May 03, 2004 5:29 PM To: php-general@lists.php.net Subject: [PHP] Download manager Hi I wanna create a download manager that keeps the true path hidden from my visitors to prevent unauthorized access... I've googled for such tutorial but i can'f find anything. Can someone please give me a link to that kind of tutorial... Regards...

« previous php.general (#185190) next »