Surreal CMS can only change files inside your site's upload folder. Here's why that folder should be a folder of its own, and what goes wrong when it isn't.
What the upload folder does
When someone uploads an image, links to a PDF, or opens the file manager, they're working inside the site's upload folder. They can upload, rename, move, and delete anything in it, but nothing outside of it.
What goes wrong when it's the home folder
Pointing the upload folder at the home folder gives users the whole website. Users see every file and
folder on the site in the file manager, including pages, stylesheets, scripts, and whatever else lives
there. They can rename index.html, delete the css folder, or drop a stray file
in the root.
It's easy to do by accident. Someone tidying up a folder of old photos can take the homepage with it, and renaming a file breaks every link to it. Deleted files can't be recovered from Surreal CMS. Revisions cover pages, not files.
Set it up
Create a folder called uploads in your home folder, and choose it as the upload folder when
you connect the site. On FTP, SFTP, and WebDAV the folder has to exist
before the first upload, so create it on the server first. On Amazon S3, Cloudflare R2, and DigitalOcean
Spaces it's a key prefix, so there's nothing to create.
Keep pages and anything you don't want renamed out of it. Link to images from there in your HTML,
such as uploads/hero.jpg, so the images your users manage are the ones they see in the
editor. An existing images folder works too, as long as nothing but images lives in it.
The folder has to be publicly reachable. Surreal CMS fetches images from your live site to make gallery
thumbnails, and writes them to a thumbnails folder inside the upload folder.
Existing sites
You can change the upload folder any time in Site Settings. Changing it doesn't move
any files. If you're moving from the home folder to an uploads folder, move the files
your users have uploaded into the new folder and update the links on your pages.
Scan for Pages skips the upload folder, so a page that ends up in there won't be found. That's one more reason to keep pages out of it.
Pages have their own controls
The upload folder covers files, not pages. Users can delete pages from the Pages list by default, and deleting a page removes the file from your server. Turn off Delete pages in Site Settings if they shouldn't. Locking a site stops edits and file changes altogether until you unlock it, which is handy while you work on the site yourself.
Checklist
- A folder called
uploads, or one that holds only uploaded files - Inside the home folder, and created on the server for FTP, SFTP, and WebDAV
- No pages, stylesheets, or scripts in it
- Publicly reachable
- Images on your pages linked from it
- Delete pages turned off if your users don't need it
The file manager docs cover what users can do inside the folder, and integration best practices has the short version of this post.