edit: create missing directories on save
authorMischa POSLAWSKY <perl@shiar.org>
Thu, 14 Sep 2017 15:41:12 +0000 (17:41 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Mon, 18 Sep 2017 18:21:28 +0000 (20:21 +0200)
edit.php

index 2a63bd2d4f865d1fd1c9dba95689ce40e2a15039..f0d001e9fc6d029d06b24ea49acd147049600f0a 100644 (file)
--- a/edit.php
+++ b/edit.php
@@ -34,6 +34,9 @@ if (!strlen($upload)) {
        exit;
 }
 
+if (!file_exists(dirname($filename)) and !mkdir(dirname($filename)))
+       abort('500 save error', "fout bij aanmaken van map voor $filename");
+
 if (!file_put_contents($filename, $upload))
        abort('500 save error', "fout bij schrijven van $filename");