diff options
Diffstat (limited to 'src/Handlers/NewNote.php')
-rw-r--r-- | src/Handlers/NewNote.php | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/Handlers/NewNote.php b/src/Handlers/NewNote.php index 9c60757..9d4286d 100644 --- a/src/Handlers/NewNote.php +++ b/src/Handlers/NewNote.php @@ -7,6 +7,7 @@ namespace Micropoly\Handlers; use Micropoly\Env; use Micropoly\Esc; use Micropoly\Handler; +use Micropoly\Models\Attachment; use Micropoly\Models\Note; class NewNote implements Handler @@ -29,6 +30,9 @@ class NewNote implements Handler $note->setTags($_POST["tag"]); $note->save($env->db()); + if (isset($_FILES['attachments'])) + Attachment::createFromUploads($env->db(), $env->attachmentsPath(), $note, $_FILES['attachments']); + $url = $env->documentRoot() . "n/" . $note->getId(); http_response_code(303); header("Location: {$url}"); |