2009-01-23 113 views
0
$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."; 
} 
} 

上述代码用于工作。现在它不会让我上传文件到../上传/但它工作正常,如果我上传上传/。 有没有人有任何建议,我做错了什么?由于将文件上传到当前文件夹上方的文件夹

编辑

$target = "../uploads/"; 
+0

你能粘贴你设置'$ target'的位置吗?当你尝试上传到'./uploads/'时它说了什么? – 2009-01-23 16:25:16

+0

我收到一个“对不起,上传文件时出现问题,请按回浏览器并重试”错误 – Drew 2009-01-23 16:29:05

回答

1

我知道这听起来很愚蠢,但都是建立在正确的文件夹的权限?