Thank you greensweater and zzz for your quick responses. I really appreciate it.
My testing has been on IE version 6 and yes I have the latest Windows service packs. I have been testing on my PC in my home office and also on PCs at our company office. On my home PC, it occasionally succeeds in IE but mostly gets the "page cannot be displayed" error. It always gets "page cannot be displayed" at the company office. It runs successfully 100% of the time in FireFox and no errors show in the Error Console on all testing PCs.
Below is my code. Perhaps you can spot something that I am missing. getfile.php prompts the user for the file they want to upload from their local PC. I'm not having any problems with this file. Then savfile.php uploads the file to the mysql database and displays details about the file uploaded back to the user. This is the file that occasionally succeeds in IE but mostly gets the "page cannot be displayed error". Thanks again for your help.
getfile.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title> Upload a File to the Database</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF">
<form enctype="multipart/form-data" name="frmUploadFile" action="savfile.php" method="post">
<p> </p>
<p> </p>
<table width="75%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr bgcolor="#000066">
<td width="100%" height="22" colspan="2">
<p style="margin-left: 10"><b><font face="Verdana" size="2" color="#FFFFFF">
Upload a File</font></b>
</td>
</tr>
<tr bgcolor="#6699CC">
<td width="100%" colspan="2">
<p style="margin-left: 10; margin-right: 10"><font face="Verdana" size="2">
<br>Please select a file from your local computer to upload and save in
the MBF database. <br> </font>
</td>
</tr>
<tr>
<td width="15%" nowrap bgcolor="#6699CC"> <p style="margin-left: 10"><font face="Verdana" size="2"> File Description: </font>
</td>
<td width="85%" bgcolor="#6699CC"><input type="text" name="strDesc" size="20"
maxlength="50"></td>
</tr>
<tr>
<td width="15%" bgcolor="#6699CC">
<p style="margin-left: 10"><font face="Verdana" size="2">File
Location: </font>
</td>
<td width="85%" bgcolor="#6699CC">
<font face="Verdana" size="2">
<input type="hidden" name="MAX_FILE_SIZE" value="2000000">
<input type="file" name="fileUpload" size="20"></font>
</td>
</tr>
<tr>
<td width="33%" bgcolor="#6699CC">
<p style="margin-left: 10"><font face="Verdana" size="2"><br><br> </font>
</td>
<td width="67%" bgcolor="#6699CC">
<font face="Verdana" size="2"><input type="submit" value="Upload this file"
name="cmdSubmit"></font>
</td>
</tr>
</table>
</form>
</body>
</html>
savfile.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Save File to Database</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
error_reporting(E_ALL);
if ($_FILES['fileUpload']['error'] > 0)
{
echo 'Problem: ';
switch ($_FILES['fileUpload']['error'])
{
case 1: echo 'File exceeded upload_max_filesize'; break;
case 2: echo 'File exceeded max_file_size'; break;
case 3: echo 'File only partially uploaded'; break;
case 4: echo 'No file uploaded'; break;
}
exit;
}
if(isset($_POST['cmdSubmit']) && $_FILES['fileUpload']['size'] > 0)
{
$fileName = $_FILES['fileUpload']['name'];
$tmpName = $_FILES['fileUpload']['tmp_name'];
$fileSize = $_FILES['fileUpload']['size'];
$fileType = $_FILES['fileUpload']['type'];
$fileDesc = $_POST['strDesc'];
$fp = fopen($tmpName, 'r');
$content = fread($fp, filesize($tmpName));
$content = addslashes($content);
fclose($fp);
if(!get_magic_quotes_gpc())
{
$fileName = addslashes($fileName);
}
$link_id = mysql_connect($hostname, $user, $password);
if (!$link_id)
{
echo "<b>Error:</b> Could not connect to database. Please try again later.";
exit;
}
$db_select = mysql_select_db($database, $link_id);
if (!$db_select)
{
echo "<b>Error:</b> Could not select database. Please try again later.";
exit;
}
$query = "LOCK TABLES Test_DocStor WRITE";
$result = mysql_query($query);
$query = "insert into Test_DocStor
values(0,'$fileName','$fileDesc','$fileType','$fileSize','$content')";
$result = mysql_query($query);
if (!$result)
{
echo "<b>Error:</b> Upload to database failed.<br>";
echo "Error: ".mysql_errno()."; error description: ".mysql_error();
exit;
}
$query = "UNLOCK TABLES";
$result = mysql_query($query);
echo "<p> </p><p> </p><table width='50%' align=center border=0 cellspacing=0 cellpadding=0><tr bgcolor='#000066'><td colspan=2 align=center><font face='Verdana' size=2 color='#ffffff'>The details of the uploaded file are shown below</font></td></tr>";
echo "<tr bgcolor='#6699CC'><td width=50% align=right><font face='Verdana' size='2'><b>File name: </b></font></td><td><font face='Verdana' size='2'>$fileName</font></td></tr>";
echo "<tr bgcolor='#6699CC'><td width=50% align=right><font face='Verdana' size='2'><b>File description: </b></font></td><td><font face='Verdana' size='2'>$fileDesc</font></td></tr>";
echo "<tr bgcolor='#6699CC'><td width=50% align=right><font face='Verdana' size='2'><b>File type: </b></font></td><td><font face='Verdana' size='2'>$fileType</font></td></tr>";
echo "<tr bgcolor='#6699CC'><td width=50% align=right><font face='Verdana' size='2'><b>File size: </b></font></td><td><font face='Verdana' size='2'>$fileSize</font></td></tr>";
echo "</table>";
}
?>
</body>
</html>