I never uploaded a file before and I'm finding some problems regarding uploading a file in a directory which have some security. I searched on the internet and I found out that I need to make use of chmod php function however I have been fighting against my computer for two days now and I can't understand what is wrong with my coding. So here is my coding:
chmod("directory",0777);
if(isset($_POST['submit']))
{
$target_path = "directory";
$target_path = $target_path . basename($_FILES['uploadedfile']['name']);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path))
{
mysql_query("UPDATE account SET image = 'name' WHERE id = '$id'");
echo"$name";
} else{
echo"NO";
}
}
Thank you for your attention and time