# drive_file_upload

Store File in a Drive

## Beschreibung

Stores an uploaded file in a drive. Upload first via
`attachment_upload`, then pass the returned handle here —
either the `att_…` attachment_id or the `file_url`. For
presigned uploads the PUT must have completed, otherwise this
returns `upload_incomplete`.

`filename` is the name inside the drive (used verbatim; a
sibling collision auto-renames to "name (1).ext"). MIME type
and byte size come from the uploaded blob.

## Zugriff

Zugriffsprofil: `gated`. Module: `files`.
Die Freigabe im Profil ersetzt keine Account-, Workspace- oder Rollenberechtigung.

## Parameter

| Name | Typ | Pflicht | Beschreibung |
| --- | --- | --- | --- |
| `account_id` | string | Ja |  |
| `drive_id` | string | Ja |  |
| `folder_id` | string / null | Nein | Destination folder (dfo_…). Omit for root. |
| `filename` | string | Ja |  |
| `attachment_id` | string | Ja | att_… id or file_url from attachment_upload. Up to 1 GB. |

## Eingabeschema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "properties": {
    "account_id": {
      "type": "string"
    },
    "drive_id": {
      "type": "string"
    },
    "folder_id": {
      "type": [
        "string",
        "null"
      ],
      "description": "Destination folder (dfo_…). Omit for root."
    },
    "filename": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255
    },
    "attachment_id": {
      "type": "string",
      "description": "att_… id or file_url from attachment_upload. Up to 1 GB."
    }
  },
  "required": [
    "account_id",
    "drive_id",
    "filename",
    "attachment_id"
  ],
  "type": "object"
}
```

## Ausgabeschema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "properties": {
    "id": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "content_type": {
      "type": "string"
    },
    "byte_size": {
      "type": "integer"
    },
    "folder_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "drive_id": {
      "type": "string"
    }
  },
  "required": [
    "id",
    "name",
    "content_type",
    "byte_size",
    "folder_id",
    "drive_id"
  ],
  "type": "object"
}
```
