fixed directory location

This commit is contained in:
Felix Ivo 2025-07-07 15:08:56 +02:00
parent 26fb9b54b6
commit 92e162283e
2 changed files with 3 additions and 3 deletions

View File

@ -224,7 +224,7 @@ class NotesModel extends Database
$pdo = $this->linkDB(); $pdo = $this->linkDB();
if (!$pdo) return ['success' => false, 'message' => 'Database error.']; if (!$pdo) return ['success' => false, 'message' => 'Database error.'];
$uploadDir = $_SERVER['DOCUMENT_ROOT'] . '/EIANotesApp/Uploads/'; $uploadDir = __DIR__ . '/../Uploads/';
$uploadedFileNames = []; $uploadedFileNames = [];
if (!file_exists($uploadDir)) { if (!file_exists($uploadDir)) {
@ -269,7 +269,7 @@ class NotesModel extends Database
$stmt->execute([$fileId]); $stmt->execute([$fileId]);
$file = $stmt->fetch(); $file = $stmt->fetch();
if ($file) { if ($file) {
$filePath = $_SERVER['DOCUMENT_ROOT'] . '/EIANotesApp/Uploads/' . $file['stored_filename']; $filePath = __DIR__ . '/../Uploads/' . $file['stored_filename'];
if (file_exists($filePath)) { if (file_exists($filePath)) {
unlink($filePath); unlink($filePath);
} }

View File

@ -4,7 +4,7 @@ include dirname(__DIR__).'/header.phtml';
//// Test write permissions //// Test write permissions
//// This is the directory we will upload files to. //// This is the directory we will upload files to.
//$uploadDir = $_SERVER['DOCUMENT_ROOT'] . '/EIANotesApp/Uploads/'; //$uploadDir = __DIR__ . '/../Uploads/';
//if (!file_exists($uploadDir)) { //if (!file_exists($uploadDir)) {
// mkdir($uploadDir, 0777, true); // mkdir($uploadDir, 0777, true);
//} //}