# IRPCWOPIOperationsPublic.WOPIUploadFile

Location: [gRPC API](https://developer.m-files.com/APIs/gRPC-API/index.md) > [Server integration API](https://developer.m-files.com/APIs/gRPC-API/integration/index.md) > [WOPI operations (anonymous)](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCWOPIOperationsPublic/index.md)

HTML version: https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCWOPIOperationsPublic/WOPIUploadFile/

Badges: `Server integration API / specialized` `internal: not for applications` `write` `no session`

Uploads a block of the new content of the file of a WOPI editing or co-authoring session.

- **Service:** [WOPI operations (anonymous)](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCWOPIOperationsPublic/index.md) `MFiles.IRPCWOPIOperationsPublic`
- **gRPC method:** `/MFiles.IRPCWOPIOperationsPublic/WOPIUploadFile`
- **HTTP (mf-http-grpc):** `POST /grpc/v1/wopiupload-file`
- **Request:** [`WOPIUploadFileRequest`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCWOPIOperationsPublic/WOPIUploadFile/index.md#request)
- **Response:** [`WOPIUploadFileResponse`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCWOPIOperationsPublic/WOPIUploadFile/index.md#response)
- **Book and level:** Server integration API, specialized
- **Kind:** write
- **Session:** Not needed: the call can be made before logging in.
- **Idempotent:** no
- **Returns metadata structure version:** no
- **Streaming:** none (unary)

<a id="remarks"></a>

## Remarks

**For M-Files components only.** The M-Files WOPI service calls it when Office for the web saves
the file. Applications should not call it.
- Works only with a token whose link is for editing or co-authoring; others fail with "The
  parameter is incorrect.". The token's user needs read and edit access to the object.
- The first call has `upload_id` 0 and `offset` 0 and returns the upload ID; later calls pass
  it. Complete the upload with
  [WOPIUploadFileCommit](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCWOPIOperationsPublic/WOPIUploadFileCommit/index.md). A failed
  call deletes the upload.

<a id="request"></a>

## Request: WOPIUploadFileRequest

> Nested message fields are expanded to depth 3; follow a type link for deeper levels and for the type's own page.

| Field | Type | Description |
|---|---|---|
| `wopi_user_session_key` | `string` | The WOPI user session token. |
| `upload_id` | `int32` | 0 to start a new upload, otherwise the ID returned by the first call. |
| `total_size_in_bytes` | `int64` | The total size of the file in bytes. Used only when `offset` is 0. |
| `offset` | `int64` | The position of `data` in the file. Use multiples of 4096 bytes. |
| `data` | `bytes` | The block. Use multiples of 4096 bytes, except for the last block. |

<a id="response"></a>

## Response: WOPIUploadFileResponse

> Nested message fields are expanded to depth 3; follow a type link for deeper levels and for the type's own page.

| Field | Type | Description |
|---|---|---|
| `upload_id` | `int32` | Receives the identifier of this upload operation. |

<a id="related"></a>

## Related methods

- [WOPIUploadFileCommit](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCWOPIOperationsPublic/WOPIUploadFileCommit/index.md): Stores an upload made with WOPIUploadFile as the new content of the file of the WOPI session.
