Awsome almost everything is working. The only thing that is not happening is it's not inserting the image path into the table in the database.

Here is the new code:

include 'Images_db_connect.php';
mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
mysql_select_db("$db_name")or die("cannot select DB");

//info sent from form
$imagename =$_POST['image'];
$caption =$_POST['caption'];
$category =$_POST['category_name'];

//to protect from mysql injection
$imagename = stripslashes($imagename);
$caption = stripslashes($caption);
$category = stripslashes($category);

$imagename = mysql_real_escape_string($imagename);
$caption = mysql_real_escape_string($caption);
$category = mysql_real_escape_string($category);

//insert info into table in database
$sql = "INSERT into photos (image_name, caption, image_path, category) VALUES ('$imagename', '$caption', '$uploadimages', '$category')";
mysql_query($sql) or die(mysql_error());

//define a maxim size for the uploaded images in Kb
 define ("MAX_SIZE","75"); 
if(isset($_FILES['file']['name']) && $_FILES['file']['name']<>""){
$typ = $_FILES['file']['type'];
if($typ == "image/gif" || $typ == "image/png" || $typ == "image/jpeg" || $typ == "image/pgif" || $typ == "image/ppng" || $typ == "image/pjpeg"){
$uploaddir = "images/";
$uploadimages = $uploaddir.$_FILES['file']['name'];
if(move_uploaded_file($_FILES['file']['tmp_name'], $uploadimages)){
echo "File successfully copied";
echo "Copy unsuccessful";
echo "Incorrect file type";
echo "No file selected";
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.