hello there - i was wondering if anyone could help me.
i've only started php and mysql today and so far have managed to create a database and table and found a script to upload images to a database although i seem to be getting errors with this script i.e. Notice: Undefined index: fileUpload
this is where i got the script from which seems to be fine
http://www.devarticles.com/content.php?articleId=68&page=4
but loses the explanation a little so what i have not got is this:
<?php
// GrabFile.php: Takes the details
// of the new file posted as part
// of the form and adds it to the
// myBlobs table of our myFiles DB.
global $strDesc;
global $fileUpload;
global $fileUpload_name;
global $fileUpload_size;
global $fileUpload_type;
echo $HTTP_POST_VARS["strDesc"];
echo $HTTP_POST_VARS["fileUpload"];
//echo $HTTP_POST_VARS["fileUpload_name"];
//echo $HTTP_POST_VARS["fileUpload_size"];
//echo $HTTP_POST_VARS["fileUpload_type"];
// Make sure both a description and
// file have been entered
if(empty($strDesc) || $fileUpload == "none")
die("You must enter both a description and file");
// Database connection variables
$dbServer = "localhost";
$dbDatabase = "pics";
$dbUser = "admin";
$dbPass = "password";
$fileHandle = fopen($fileUpload, "r");
$fileContent = fread($fileHandle, $fileUpload_size);
$fileContent = addslashes($fileContent);
$sConn = mysql_connect($dbServer, $dbUser, $dbPass)
or die("Couldn't connect to database server");
$dConn = mysql_select_db($dbDatabase, $sConn)
or die("Couldn't connect to database $dbDatabase");
$dbQuery = "INSERT INTO reunion VALUES ";
$dbQuery .= "(0, '$strDesc', '$fileContent', '$fileUpload_type')";
mysql_query($dbQuery) or die("Couldn't add file to database");
echo "<h1>File Uploaded</h1>";
echo "The details of the uploaded file are shown below:<br><br>";
echo "<b>File name:</b> $fileUpload_name <br>";
echo "<b>File type:</b> $fileUpload_type <br>";
echo "<b>File size:</b> $fileUpload_size <br>";
echo "<b>Uploaded to:</b> $fileUpload <br><br>";
echo "<a href='uploadfile.php'>Add Another File</a>";
?>
i have tried search on the internet for this error but the only examples i am getting are pages with this error on - what does it mean and what do i do!!
any help would be very beneficial.
regards
😕