i want to upload the file and save it to uploads folder in our directory. i have done that by using that code.. but its not working..here is an error..
"Warning: move_uploaded_file(uploads/1341221475::1aaaa.text): failed to open stream: Permission denied in /var/www/html/PHP/upload_file.php on line 24 Warning: move_uploaded_file(): Unable to move '/tmp/phpSZhm3c' to 'uploads/1341221475::1aaaa.text' in /var/www/html/PHP/upload_file.php on line 24 Stored in: aaaa/aaaa.text"
please help
code :
if($_FILES["file"]["error"] > 0)
{
echo "ERROR ".$_FILES["file"]["error"]."<br>";
}
else
{
echo "NAME : ".$_FILES["file"]["name"]."<br>";
echo "TYPE : ".$_FILES["file"]["type"]."<br>";
echo "SIZE : ".($_FILES["file"]["size"]/1024)."KB<br>";
echo "Stored in : ".$_FILES["file"]["tmp_name"]."<br>";
if (file_exists("aaaa/" . $_FILES["file"]["name"]))
{
echo $_FILES["file"]["name"] . " already exists. ";
}
else
{
$target_path = "uploads/";
$target_path = $target_path . time() . $_SERVER['REMOTE_ADDR'] . basename( $_FILES['file']['name']);
move_uploaded_file($_FILES["file"]["tmp_name"],$target_path);
echo "Stored in: " . "aaaa/" . $_FILES["file"]["name"];
}
}