Fix upload directory path issue

- Change UPLOAD_DIR from ../uploads to ./uploads in server/.env
- Use absolute path with process.cwd() in upload middleware
- Ensures uploads directory is created in correct location
This commit is contained in:
2025-11-16 22:54:30 +00:00
parent 39ce69172d
commit 4e5ab7d41b
2 changed files with 3 additions and 3 deletions

View File

@@ -2,8 +2,8 @@ import multer from 'multer';
import path from 'path';
import fs from 'fs';
// Ensure upload directory exists
const uploadDir = process.env.UPLOAD_DIR || './uploads';
// Ensure upload directory exists - use absolute path
const uploadDir = process.env.UPLOAD_DIR || path.join(process.cwd(), 'uploads');
if (!fs.existsSync(uploadDir)) {
fs.mkdirSync(uploadDir, { recursive: true });
}