Now it says "no file selected"

weired its working on my pc, try the attaced files

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:

<?php
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";
}
else{
echo "Copy unsuccessful";
}
}
else{ 
echo "Incorrect file type";
}
}
else{
echo "No file selected";
}
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.