我有一个表单,可以将一些文件发送到php脚本。 我已经设置了
file_uploads = On
在php.ini文件中。
当我为777权限设置上传文件夹时,它可以正常工作。 但不适用于775和776。
有人能给我一些启示吗?
非常感谢。
P.S。:如果需要,那就是我的文件:
if (isset($_FILES['groupImage' . $i])) {
foreach ($_FILES['groupImage' . $i]['name'] as $f => $name) {
if ($_FILES['groupImage' . $i]['error'][$f] == 4) {
continue; // Skip file if any error found
}
if ($_FILES['groupImage' . $i]['error'][$f] == 0) {
if ($_FILES['groupImage' . $i]['size'][$f] > $max_file_size) {
$message[] = "$name is too large!.";
continue; // Skip large files
}
elseif( ! in_array(pathinfo($name, PATHINFO_EXTENSION), $valid_formats) ){
$message[] = "$name is not a valid format";
continue; // Skip invalid file formats
}
else{ // No error found! Move uploaded files
if(move_uploaded_file($_FILES["groupImage" . $i]["tmp_name"][$f], $path . $property_id . "_" . $count . "." . pathinfo($name, PATHINFO_EXTENSION))) {
$count++; // Number of successfully uploaded file
}
}
}
}
<input name="groupImage1[]" type="file" id="inputFiles" multiple>