diff --git a/Model/NotesModel.php b/Model/NotesModel.php index d08c891..b6d94f8 100644 --- a/Model/NotesModel.php +++ b/Model/NotesModel.php @@ -224,7 +224,7 @@ class NotesModel extends Database $pdo = $this->linkDB(); if (!$pdo) return ['success' => false, 'message' => 'Database error.']; - $uploadDir = $_SERVER['DOCUMENT_ROOT'] . '/EIANotesApp/Uploads/'; + $uploadDir = __DIR__ . '/../Uploads/'; $uploadedFileNames = []; if (!file_exists($uploadDir)) { @@ -269,7 +269,7 @@ class NotesModel extends Database $stmt->execute([$fileId]); $file = $stmt->fetch(); if ($file) { - $filePath = $_SERVER['DOCUMENT_ROOT'] . '/EIANotesApp/Uploads/' . $file['stored_filename']; + $filePath = __DIR__ . '/../Uploads/' . $file['stored_filename']; if (file_exists($filePath)) { unlink($filePath); } diff --git a/Views/Notes/createNote.phtml b/Views/Notes/createNote.phtml index 6fc2d9e..ae45380 100644 --- a/Views/Notes/createNote.phtml +++ b/Views/Notes/createNote.phtml @@ -4,7 +4,7 @@ include dirname(__DIR__).'/header.phtml'; //// Test write permissions //// This is the directory we will upload files to. -//$uploadDir = $_SERVER['DOCUMENT_ROOT'] . '/EIANotesApp/Uploads/'; +//$uploadDir = __DIR__ . '/../Uploads/'; //if (!file_exists($uploadDir)) { // mkdir($uploadDir, 0777, true); //}