fix: Q&A 파일 업로드 권한 오류 수정

This commit is contained in:
root
2026-08-27 16:57:49 +09:00
parent ed4edccc54
commit ac9a784f7e
4 changed files with 38 additions and 23 deletions
+6 -2
View File
@@ -65,12 +65,16 @@ if ($isEdit) {
function handle_file_uploads(PDO $pdo, int $postId, array &$errors) {
if (empty($_FILES['attach']['name'][0])) return;
$uploadDir = __DIR__ . '/../uploads/qa/';
$uploadDir = dirname(__DIR__) . '/uploads/qa';
if (!is_dir($uploadDir)) {
mkdir($uploadDir, 0777, true);
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[] = '업로드 폴더에 쓰기 권한이 없습니다.';
+6 -2
View File
@@ -65,12 +65,16 @@ if ($isEdit) {
function handle_file_uploads(PDO $pdo, int $postId, array &$errors) {
if (empty($_FILES['attach']['name'][0])) return;
$uploadDir = __DIR__ . '/../uploads/qa/';
$uploadDir = dirname(__DIR__) . '/uploads/qa';
if (!is_dir($uploadDir)) {
mkdir($uploadDir, 0777, true);
if (!mkdir($uploadDir, 0777, true) && !is_dir($uploadDir)) {
$errors[] = 'Upload folder could not be created.';
return;
}
}
if (!is_writable($uploadDir)) {
@chmod($uploadDir, 0777);
clearstatcache(true, $uploadDir);
}
if (!is_writable($uploadDir)) {
$errors[] = 'Upload folder is not writable.';
+8 -1
View File
@@ -69,9 +69,16 @@ mkdir -p \
egbim/data/cache \
egbim/data/session \
egbim/data/log \
egbim/uploads/qa \
eng/data/cache \
eng/data/session \
eng/data/log
eng/data/log \
eng/uploads/qa
# uploads/qa 는 Git이 디렉터리 권한을 보존하지 않으며, app 컨테이너의
# Apache(www-data)가 bind mount 된 호스트 디렉터리에 파일을 저장해야 한다.
# 배포 직후에도 Q&A 첨부파일을 저장할 수 있도록 권한을 명시한다.
chmod 0777 egbim/uploads/qa eng/uploads/qa
mkdir -p docker/mysql/init
+1 -1
View File
@@ -9,7 +9,7 @@ case "$remote_mode" in
remote_url="https://gitea.hmac.kr/b24014/egbim_homepage.git"
;;
ssh)
remote_url="ssh://git@172.16.10.175:22/b24014/egbim_homepage.git"
remote_url="ssh://git@10.13.10.4:22/b24014/egbim_homepage.git"
;;
*)
echo "Usage: $0 [https|ssh]" >&2