I'm storing Excel and Word files in a database and when I go to send them from the database to the requesting browser, Microsoft asks for the user to enter their network password. I get a screen from either Microsoft Exel or Word asking the user to enter their authentication information for a resource (which is the URL used to download the file).
I merely want to have these files displayed in the browser without confusing lesser computer savvy users. Is there a header I should use in addition to "Content-Type:"?
Thanks!
Mark
Here's the code:
<?php require_once('Connections/connIndeq.php'); ?>
<?php
$colname_rsDoc = "1";
if (isset($HTTP_GET_VARS['n'])) {
$colname_rsDoc = (get_magic_quotes_gpc()) ? $HTTP_GET_VARS['n'] : addslashes($HTTP_GET_VARS['n']);
}
mysql_select_db($database_connIndeq, $connIndeq);
$query_rsDoc = sprintf("SELECT filetype, doc, filename FROM testsession WHERE id = %s", $colname_rsDoc);
$rsDoc = mysql_query($query_rsDoc, $connIndeq) or die(mysql_error());
$row_rsDoc = mysql_fetch_assoc($rsDoc);
$totalRows_rsDoc = mysql_num_rows($rsDoc);
$nameArray = split('/',$row_rsDoc["filename"]);
Header('Content-type: '.$row_rsDoc['filetype'].'; name="'.array_pop($nameArray).'"');
echo gzuncompress($row_rsDoc['doc']);
mysql_free_result($rsDoc); ?>