将文件上载到当前文件夹上方的文件夹

时间:2009-01-23 16:23:45

标签: php

$result = mysql_query("SELECT * FROM media WHERE path = '$target'");
if($row = mysql_num_rows($result)==1)
{
echo"<br />Sorry, there is already a file with that name on the server.<br     />Please press back on your browser and save the file under a different name.";
}else{

if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
{
echo "The file ". basename( $_FILES['uploaded']['name']). " has been uploaded";
mysql_query("INSERT INTO media (id, related_page_id, type, title, copy, path, position, assets, time) VALUES ('', '$cat','$type','$name','','$target','$position','$id','$today')");

header("Location: edit.php?category=$cat");
exit();
echo $name;
}
else {
echo $today;
echo "<br />";
echo "Sorry, there was a problem uploading your file. Please press back on your browser and try again.";
}
}

以上代码用于工作。现在它不会让我上传文件到../uploads/但是如果我上传到上传/它可以正常工作。 有没有人对我做错了什么有任何建议?感谢

修改

$target = "../uploads/";

1 个答案:

答案 0 :(得分:1)

我知道这听起来很傻,但文件夹设置的权限是否正确?