diff --git a/admin/maintenance.php b/admin/maintenance.php
index <HASH>..<HASH> 100644
--- a/admin/maintenance.php
+++ b/admin/maintenance.php
@@ -12,6 +12,11 @@
         error('You need to be admin to use this page');
     }
 
+    //Check folder exists
+    if (! make_upload_directory(SITEID)) {   // Site folder
+            error("Could not create site folder.  The site administrator needs to fix the file permissions");
+        }
+
     $filename = $CFG->dataroot.'/1/maintenance.html';
 
     if ($form = data_submitted()) {
Now SITEID folder is created if it doesn't exist. Bug <I>
(<URL>)