# Use server files from screens

> Give screens a named folder on the server (a root) for reports, recipes or exports - which operations it allows, which roles may use each, which file types, the size limit and quota - then read and write it from a screen script, with every call checked and audited.

Product: eaxScada · Type: How-to guide · Editions: Starter, Pro, Enterprise
Source: https://eaxware.com/docs/eaxscada/how-to/use-server-files/
Status: migrated page, not yet verified against the current code.

## Goal

Operators save shift reports from a screen into `D:\eax\shift-reports` on the server; supervisors and engineers may also write there; nobody may delete. Screens can reach only that folder, only `.csv` and `.pdf` files, and every read and write is recorded with the file's SHA-256.

## Before you start

- You are an **Administrator**: only administrators define roots.
- The folder exists on the server. It cannot be a whole drive, the server's `data`, `config` or program folder, or overlap another root. On a high-availability pair, create it on both nodes: the roots are replicated, the files are not.
- Edition: Free has no server files; Starter one root (the first); Pro and Enterprise any number.

## 1. Define the root

1. Open **Security → Server files** and click **New root**.
2. Fill it in:

   | Field | Example | Meaning |
   |---|---|---|
   | Name | `shift-reports` | the name scripts use: lower-case letters, digits, `-` and `_` |
   | Folder on the server | `D:\eax\shift-reports` | an absolute path; only administrators see it |
   | Operations | list, read, write | `write` also creates folders; `delete` stays off unless you need it |
   | Read roles | Shift_Operator, Process_Supervisor, Lead_Engineer | who may list and read |
   | Write roles | Process_Supervisor, Lead_Engineer | who may write and create folders |
   | Delete roles | none | |
   | File types | `.csv`, `.pdf` | required: there is no "any"; program and page types (`.exe`, `.ps1`, `.js`, `.html`, `.svg`...) are never accepted |
   | Largest file / quota | 10 MB / 500 MB | |

3. Save. The change is recorded in the audit trail with the root before and after.
[Image: Security, Server files: the root shift-reports with its folder, operations, roles per operation and file types, and the file browser.]
[Image: Security, Server files: the root shift-reports with its folder, operations, roles per operation and file types, and the file browser.]

A root for shift reports.
A role that is not listed for an operation is refused it, **the Administrator included**: add Administrator to a list to use the root yourself. **Browse** shows the root's files.

## 2. Use it from a screen

```javascript
return (async () => {
  const roots = await system.file.server.roots();                 // the roots you may use
  const page = await system.file.server.list('shift-reports', ''); // one page of the folder
  await system.file.server.write('shift-reports', 'notes.csv', 'time,note\n', { overwrite: true });
  await system.file.server.download('shift-reports', 'notes.csv'); // through the browser's save dialog
})();
```

See [Script a screen](/docs/eaxscada/how-to/script-a-screen/) for a complete shift-report button, and the [Server files API](/docs/eaxscada/reference/server-files/) for every route.

## What the server refuses

Each call is checked in this order; the first failure refuses it:

1. more than 20 calls a second per user (`429`);
2. the AI assistant, an AI co-pilot account or an MCP client: always refused;
3. the edition;
4. the permission `server_files.list/stat/read/write/delete/mkdir` (an explicit deny wins; without a rule, Shift_Operator and above may list, read, write and create folders, Process_Supervisor and above may delete);
5. the root: it allows the operation and lists one of your roles;
6. the path: no absolute or drive path, no `..`, no hidden name, no device name, no link that leaves the root; the file type;
7. a standby node refuses writes (`503`).

The server never runs a file and never changes file permissions. An error names the root and the relative path, never a folder of the server.

## Audit

Every call writes one record (category `SERVER_FILES`): the user from the session, the root, the path, the operation, the size, the SHA-256 of the bytes and the result. Security → Operations audit shows them.

:::caution
Hard links inside a root cannot be detected. Do not point a root at a folder that holds hard links to files elsewhere.
:::

## Related

- [Server files API](/docs/eaxscada/reference/server-files/)
- [Screen scripting API: server files](/docs/eaxscada/reference/screen-scripting-api/#server-files)
