上传文件时,我不断收到权限错误。
警告:move_uploaded_file(/var/www/localhost/htdocs/trade-show/documents/hero_front.jpg)[function.move-uploaded-file]:无法打开流:/var/www/localhost/htdocs/ 中的权限被拒绝trade-show/selectItems.php 在第 30 行
这是我的代码。让它工作的唯一方法是使目录权限为 777。我试过 chmod 0755 没有运气。想法?
if ($_FILES['fileUpload']['error'] == 0) {
$upload = "/var/www/localhost/htdocs/trade-show/documents/".basename($_FILES['fileUpload']['name']);
if (!move_uploaded_file($_FILES['fileUpload']['tmp_name'],$upload)) {
echo "<h1>Error uploading file ".$_FILES['fileUpload']['name']."</h1>$upload<br />\n";
} else {
move_uploaded_file($_FILES['fileUpload']['tmp_name'],$upload);
}
}