I am not getting any error. But image which I am uploading is not saving in images/photo/
directory.
I see in my database is there any problem in it?
Please help me..thank you. and sorry for disturbing i'm just new in PHP language.
Here's my code in saving:
<?php
include('connect.php');
if (isset($_POST['save'])) {
addpost($_POST['fname'], $_POST['cont'], $_POST['mail'], $_POST['add'], $_POST['description'], $_FILES["image"] ["name"], $_FILES["image"] ["type"], $_FILES["image"] ["size"], $_FILES["image"] ["tmp_name"], $_FILES["image"] ["error"]);
echo $success = "<script language='javascript' >
alert('Your Post has been successfuly added!')
window.location='post.php'
</script>";
}
?>
And here's my code in connect.php :
function addpost($a, $b, $c, $d, $e, $name, $type, $size, $tmp_name, $error) {
$img = 'images/posts/' . $name;
mysql_query("INSERT post(p_name,p_contact,p_email,p_address,description,photo,dateadded) values
('$a','$b','$c','$d','$e','$img',NOW())");
if ($error > 0) {
die("Error uploading file! Code $error.");
} else {
if ($size > 10000000000) {
die("Format is not allowed or file size is too big!");
} else {
move_uploaded_file($tmp_name, "images/posts/" . $name);
}
}
}