Re: connect to a file outside the web space.

From: Date: Sun, 16 Dec 2001 04:44:25 +0000
Subject: Re: connect to a file outside the web space.
Groups: php.general 
Request: Send a blank email to php-general+get-77851@lists.php.net to get a copy of this message
Are you trying to let the user download the file? if so, can try something like this <? /*Do your login checks here*/ define(\'FILEDIR\', \'/yourdirectory/filesfordownloads/\'); $path = FILEDIR . $file; if(!is_file($path)) { print \"File does not exist!\"; //header(\"Location: error.php\"); exit(); } //force download dialog header(\"Content-type: application/octet-stream\\n\"); header(\"Content-disposition: attachment; filename=\\\"$file\\\"\\n\"); header(\"Content-transfer-encoding: binary\\n\"); header(\"Content-length: \" . filesize($path) . \"\\n\"); //send file contents $fp=fopen($path, \"r\"); fpassthru($fp); ?> >If one creates a file outside the web space on a server. >How doe\'s one connect to this >from a HTML or PHP page? > >As I understand it. It is not as simple as normal html >link.

« previous php.general (#77851) next »