---
question: How do I upload a file in Nexus Files?
kind: task
via_web: available
via_cli: na
via_python: available
via_api: available
via_config: na
ref_web: Files › File › Upload…
ref_python: put_object
ref_api: POST /api/files/upload
next:
  - /capabilities/build/files/organise-folders
  - /capabilities/build/files/use-files-in-code
---

# Upload a file

An upload writes the file into a drive of the workspace, in the folder you choose. A file with the same name in that folder is replaced without asking. The limit is 50 MB per file.

## Web UI

### Open the folder

In the Nexus workspace, open **Files**. Pick the drive under **Drives** (Workspace Drive, My Drive), then open the folder that should hold the file.

### Upload

Choose **File › Upload…** and pick one or more files. Or drop files and folders anywhere on the open folder: dropped folders are uploaded with their contents. Files shows "Uploading X of Y" until it is done.

On a phone, use **Add › Upload files**.

![Files with the File menu open](/abi/Screenshot_Files_Menu.png)

*Files › File: New File, New Folder and Upload…*

:::note
Dropping a file on a folder row does not upload into that folder. Open the folder first.
:::

### Or write a new text file

**File › New File** asks for a name (`untitled.txt` by default) and creates an empty file.

## CLI

Not applicable. There is no `abi` command for Files. Use another tab on this page. The command list is the [CLI reference](/user-guide/reference/cli).

## Python

A module can write straight into a workspace drive: Files lists what is under the drive's prefix.

### Write the object

```python
storage = self.engine.services.object_storage
storage.put_object(
    f"naas_abi/workspace-drive/{workspace_id}/reports",
    "summary.md",
    b"# Summary\n",
)
```

The prefix is the folder, the key is the file name. `put_object` replaces an existing object. The module lists `ObjectStorageService` in its dependencies: see [Use files in code](/user-guide/build/files/use-files-in-code?via=python).

## REST API

The Files routes of the Nexus API. Auth: a Nexus session of a workspace member (`POST /api/auth/login` returns the access token). Every route takes `workspace_id` and `scope` (`workspace` by default; `my_drive` needs no `workspace_id`).

### Upload

```bash
curl -X POST "http://localhost:9879/api/files/upload" \
  -H "Authorization: Bearer $NEXUS_TOKEN" \
  -F "file=@summary.md" \
  -F "path=reports" \
  -F "workspace_id=$WORKSPACE_ID" \
  -F "scope=workspace"
```

`path` is the folder; the file keeps its own name. With `abi dev up`, use the `api` port that `abi dev ports` prints. Over 50 MB answers 413. A path segment that starts with `.` answers 403.

### Or create a text file

```http
POST /api/files/
```

Body: `{"path": "reports/notes.txt", "workspace_id": "...", "scope": "workspace", "content": "Hello"}`. Unlike an upload, it answers 409 when the file exists.

## Config

Not applicable. `services.object_storage` in `config.yaml` picks where the bytes go, not what is uploaded. See [Object Storage](/user-guide/get-started/configuration#object-storage).
