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

So whats the problem ???is any error notified???or the uploading is not working....
Specify so that i could help you...

There is no error.

(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)

is always false

Check this link to get more information about your problem's solution...
Click here

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.