Bastien-
I am totally grateful for your help.
I am the type of person who will hammer away at this until it works but i am seriously stumped. Your code had a lot of double spaces in it so i was getting a lot of unexpected errors. i removed all the extra space and i am not getting the errors but now i am getting
Fatal error: Call to undefined function: connect() in /u/htdocs/dom123/fd/add.php on line 28
so i added a function connect() here:
$result=connect("INSERT INTO uptest (description,bin_data,filename,filesize,filetype)"."VALUES ('$image_desc','$data','$name','$size','$type')");
$id = mysql_insert_id();
}
function connect()
{
and i get this on the top of the screen:
This file has the following Database ID:
but it does not pass the information to the database.
here's what i have:
<?php echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">"; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head><title>Store binary data into SQL Database</title></head>
<body>
<?php
if ((isset($POST['submit']))&&(isset($FILES['form_data']))) {
upload();
} else {
show_form();
}//end if
function upload()
{
require("../Connections/firetiki.php");
//define variables
$image_file = '';
$image_desc = '';
$type = '';
$size = 0;
$name = '';
$image_file = $FILES['form_data']['tmp_name'];
$image_desc = $POST['form_description'];
$type = $FILES['form_data']['type'];
$size = $FILES['form_data']['size'];
$name = $FILES['form_data']['name'];
$data = fread(fopen($image_file, "r"), filesize($image_file));
$data = addslashes($data);
$result=connect("INSERT INTO uptest (description,bin_data,filename,filesize,filetype)"."VALUES ('$image_desc','$data','$name','$size','$type')");
$id = mysql_insert_id();
}
function connect()
{
print "<p>This file has the following Database ID: <b>$id</b>";
show_form();
}
function show_form()
{
?>
<form method="post" action="<?php echo $SERVER['PHP_SELF']; ?>" enctype="multipart/form-data">
File Description:<br>
<input type="text" name="form_description" size="40">
<input type="hidden" name="MAX_FILE_SIZE" value="1000000">
<br>File to upload/store in database:<br>
<input type="file" name="form_data" size="40">
<p><input type="submit" name="submit" value="submit">
<input type="button" name="move" value="Show" onClick="javascript:window.location='show_desc.php';">
</form>
<?php
}
?>
</body>
</html>
thanks
fitz