Hi, The following three scripts are saved as different files 1)insert_view.php 2)dBconnect.inc 3)get_picture.php. I cannot figure out how to get the header to send and not give me an error "cannot modify header information" when viewing insert_view.php and using the include file (everything works if I just create a blank html page with (img src="get_picture.php"), but that will hardly meet my needs. Do I have something in the wrong order?
insert_view.php
<html>
<head>
<title>Sans Titre</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="_custstyle.css" />
</head>
<body bgcolor="#FFFFFF">
<?PHP
//Connects to the SERVER and the DATABASE
include("dBconnect.inc");
?>
<form enctype="multipart/form-data" action="picture2.php" method="post" >
<p>Upload File<br />
<input type="file" name="uploadfile" /></p>
<p>File Description:<br />
<input type="text" name="desc" maxlength="255" /></p>
<p><input type="submit" name="go" value="Upload" /></p>
</form>
<img src="get_picture.php">
</body>
</html>
dBconnect.inc
<?
$dbcnx = mysql_connect("localhost:3306", "***", "***");
if (!$dbcnx) {
echo "<p>Unable to connect to the MySQL Server</p>";
exit ();
}
if (!mysql_select_db("test") ){
echo "<p>Unable to connect to the database at this time</p>";
exit ();
}
?>
get_picture.php
<?php
$get_image = "SELECT filedata, mimetype FROM filestore";
$get_image_result = @mysql_query($get_image) or die("Couldn't get image.");
$binary_junk = @mysql_result($get_image_result,0,"filedata");
$mimetype = @mysql_result($get_image_result,0,"mimetype");
header("Content-type: $mimetype");
echo "$binary_junk";
?>