Alright this is my code, the error im getting is in red
<?php
include("dbinfo.inc.php");
$tut_name = $_POST['tut_name'];
$tut_link = $_POST['tut_link'];
$tut_program = $_POST['tut_program'];
$tut_category = $_POST['tut_category'];
$tut_video = $_POST['tut_video'];
$tut_download = $_POST['tut_download'];
$tut_image = $_FILES['tut_image']['name'];
function getExtension($str) {
$i = strrpos($str,".");
if (!$i) { return ""; }
$l = strlen($str) - $i;
$ext = substr($str,$i+1,$l);
return $ext;
}
if (empty($tut_image)) {
$result = '<font color=FFFFFF>Please choose a photo to upload</font>';
$error++;
}
else {
$filename = stripslashes($tut_image);
$extension = getextension($filename);
$extension = strtolower($extension);
if (($extension !== "jpg") && ($extension !== "jpeg") && ($extension !== "png") && ($extension !== "gif")) {
$result = '<font color=FFFFFF>Unknown file extension, please try again</font>';
$error++;
}
else {
$tmpFile = $_FILES['tut_image']['tmp_name'];
$size = getimagesize($tmpFile);
$sizekb = filesize($tmpFile);
if ($sizekb > 10000) {
$result = '<font color=FFFFFF>The image has exceeded the size limit, please try again</font>';
$error++;
}
else {
$imageName = '../images/tutorials/' . time() . '.' . $extension;
$copy = copy($tmpFile, $imageName);
if (!$copy) {
$result = '<font color=FFFFFF>Image upload unsuccessful, please try again</font>';
$error++;
}
}
}
}
if ($error > 0) {
echo $result;
}
else {
$con = mysql_connect('localhost',$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$sql = "INSERT INTO `tutorials` VALUES ('','$tut_name','$tut_link','$tut_program','$tut_category','$tut_video','$tut_download','$imageName')";
$query = mysql_query($sql) or die('Error: ' . mysql_error());
}
mysql_close();
?>
I have also CHMODed my file destination to 777 permision