//Move the temporary file to the final location ($fullPath) if(move_uploaded_file($_FILES['imagePath']['tmp_name'], $fullPath)) { // if file movement is successful print message echo "The file $filename has been uploaded"; // Change file permissions so all can read and write to the file chmod($fullPath, 0666); // Create query for adding details to database $request = "INSERT INTO `catalogue` (`prodCode`, `prodName`, `imagePath`, `prodDesc`, `colour`, `numHoles`, `size` ) VALUES ( '$prodCode', '$prodName', '$fullPath', '$prodDesc', '$colour', '$numHoles', '$size')"; // Run query and check if successful if ($result = mysql_query($request)) { print "Button added successfully."; } else { print "Error adding button - Please report following error."; echo mysql_error($request); // echo's to check variable data echo "Product Code" . $prodCode . "\n"; echo "Product Name" . $prodName . "\n"; echo "Image Path" . $fullPath . "\n"; echo "Product Desc" . $prodDesc . "\n"; echo "Num Holes" . $numHoles . "\n"; echo "size" . $size . "\n"; } } else // if moving file failed { echo "There was an error uploading the file, please try again!"; echo "fullPath is $fullPath"; }