Try this: <?php // Open the file to send. $sFilePath = "/home/scott/public_html/TEST.doc"; $iFilePointer = fopen( $sFilePath, "r" ); // Get file content. $sContents = fread( $iFilePointer, filesize( $sFilePath ) ); // Close the file. fclose( $iFilePointer ); // Send HTTP headers. header( "Expires: 0" ); header( "Cache-Control: no-cache" ); header( "Content-Type: application/save-as" ); header( "Content-Disposition: attachment; filename=".basename( $sFilePath ).";"); header( "Content-Length: ".filesize( $sFilePath ) ); // Feed file to client. echo $sContents; ?>
As you give the client Content-Type: application/save-as - it will not know what mime type the file is, and the browser will give the user a save-as prompt. This works in explorer - I haven't checked it in Mozilla etc - so you might have to tweak it a bit. Cheers Scott ----- Original Message ----- From: "Declan Kenny" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, April 09, 2002 1:20 PM Subject: [PHP] Downloading files > Hi folks, > > Ok I am trying to make a download area for files (including word files). > How do I force a download of a word document rather than have it opening in > IE? > > Declan > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php