Thanks a mill. cgraz
You have shown me the error of my ways !!!!!!!
It is now working perfectly thanks to you.
Here is the code.
upload.html
<html>
<form enctype="multipart/form-data" method="post" action="upload10.php">
<b>Upload image</b><br>
Select image: <input name="userfile" type="file"><br>
Title: <input name="title" type="text"><br>
Description: <textarea name="descr"></textarea><br>
Alt-text: <input name="alt" type="text"><br>
<input type="submit" value="Upload">
</form>
</html>
upload10.php
<?php
$db = mysql_connect("localhost", "user", "passwd")
or die ("cant connect to the DB");
print ("connected to database successfully");
mysql_select_db("test",$db);
?><html><br><br><?php
// define the base image dir
$base_img_dir = "/var/www/html/test1/images/";
echo "The base image dir is : " . $base_img_dir;
?><html><br><br><?php
$orig_name = $HTTP_POST_FILES["userfile"]["name"];
?><html><br><br><?php
$orig_name = $_FILES["userfile"]["name"];
echo "filename : " . $orig_name;
?><html><br><br><?php
$filename = $base_img_dir.$orig_name;
//echo file path
echo "The File path and name are: " . $base_img_dir.$orig_name;
// move uploaded file to destination
move_uploaded_file($HTTP_POST_FILES["userfile"]["tmp_name"], $filename);
$query = mysql_query("INSERT INTO employees (image)
VALUES('" . $HTTP_POST_FILES["userfile"]["name"] . "')") or die(mysql_error());
//
?>