fix: Q&A 파일 업로드 권한 오류 수정
This commit is contained in:
@@ -62,16 +62,20 @@ if ($isEdit) {
|
||||
}
|
||||
|
||||
// === 파일 업로드 처리 공통 함수 ===
|
||||
function handle_file_uploads(PDO $pdo, int $postId, array &$errors) {
|
||||
if (empty($_FILES['attach']['name'][0])) return;
|
||||
|
||||
$uploadDir = __DIR__ . '/../uploads/qa/';
|
||||
if (!is_dir($uploadDir)) {
|
||||
mkdir($uploadDir, 0777, true);
|
||||
}
|
||||
if (!is_writable($uploadDir)) {
|
||||
@chmod($uploadDir, 0777);
|
||||
}
|
||||
function handle_file_uploads(PDO $pdo, int $postId, array &$errors) {
|
||||
if (empty($_FILES['attach']['name'][0])) return;
|
||||
|
||||
$uploadDir = dirname(__DIR__) . '/uploads/qa';
|
||||
if (!is_dir($uploadDir)) {
|
||||
if (!mkdir($uploadDir, 0777, true) && !is_dir($uploadDir)) {
|
||||
$errors[] = '업로드 폴더를 생성할 수 없습니다.';
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!is_writable($uploadDir)) {
|
||||
@chmod($uploadDir, 0777);
|
||||
clearstatcache(true, $uploadDir);
|
||||
}
|
||||
if (!is_writable($uploadDir)) {
|
||||
$errors[] = '업로드 폴더에 쓰기 권한이 없습니다.';
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user