> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gravixlayer.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Upload File

> Upload a local file to an agent runtime

```python theme={null}
import io
from gravixlayer import GravixLayer

client = GravixLayer()
runtime = client.runtime.create(template="python-3.14-base-small")

# Upload from a file-like object (any binary stream)
buffer = io.BytesIO(b"hello from local upload\n")
response = runtime.file.upload_file(buffer, path="/workspace/local-file.txt")
print(response.message)
print(response.path)
print(response.size)

# Or upload bytes/string directly with `upload` (no file handle required)
runtime.file.upload("/workspace/notes.txt", b"plain text bytes\n")

runtime.kill()
```

## Parameters

| Parameter | Type     | Required | Description                       |
| --------- | -------- | -------- | --------------------------------- |
| `file`    | BinaryIO | Yes      | File object opened in binary mode |
| `path`    | string   | No       | Destination path inside runtime   |

## Response

| Field     | Type    | Description          |
| --------- | ------- | -------------------- |
| `message` | string  | Confirmation message |
| `path`    | string  | Uploaded file path   |
| `size`    | integer | File size in bytes   |
