note 42457 deleted from function.header by nlopess

From: Date: Mon, 17 May 2004 18:40:27 +0000
Subject: note 42457 deleted from function.header by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-69728@lists.php.net to get a copy of this message
Note Submitter: toni ---- IN PHP i need to use the function readfile(filename) to show in a box the file to download i get the filename from a SELECT in sql from one table of the DATABASE, but the function reads from the local directory of the server(c:\myproject\filename.pdf) i don t know how to get the file. in the table at the database i have of each file , the datasize, filename, remoteip , i think that the solution could be with this but i don t know how. i think the solution is access to the direction of the database that is stored the file but i don t know how to implement, (http:ipadress/filename) or with another way ftp:/.... because when i put only the name of the file INSIDE the readfile command, appear the box of the dowload but with the path of the my local scripts directory THIS IS THE CODE I USE function Download($rFilename,$rdatasize) { $TheFile = basename($rFilename); header( "Content-Type: application/octet-stream"); // header( "Content-Length: ".filesize($rFilename)); header( "Content-Length: ".$rdatasize); header( "Content-Disposition: attachment; filename=".$TheFile.""); readfile($rFilename); } $conexion = odbc_connect("DSNinfi","","") or die("Error: No possible connection"); $sSQL = "SELECT filename,datasize FROM VERSION WHERE document_id = $_REQUEST[file]"; $document = odbc_exec($conexion,$sSQL) or die("Error: No possible make sql"); Download(odbc_result($document, "filename"),odbc_result($document, "datasize")); THANKS

« previous php.notes (#69728) next »