我想上传文件并将其保存到我们目录中的上传文件夹中。我已经通过使用该代码来做到这一点..但它不起作用..这是一个错误..
“警告:move_uploaded_file(uploads/1341221475::1aaaa.text):无法打开流:第 24 行 /var/www/html/PHP/upload_file.php 中的权限被拒绝警告:move_uploaded_file():无法移动'/tmp /phpSZhm3c' to 'uploads/1341221475::1aaaa.text' in /var/www/html/PHP/upload_file.php on line 24 存储在:aaaa/aaaa.text”
请帮忙
代码 :
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"];
}
}