# IRPCDocumentOperationsFileIOInternal.UploadFileCommit2

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) > [Document file I/O for server components](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCDocumentOperationsFileIOInternal/index.md)

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

Badges: `Server integration API / specialized` `internal: not for applications` `write` `session or assertion` `returns metadata structure version`

Completes an upload made with UploadFile and stores it as the new content of the file; returns
only the data file version.

- **Service:** [Document file I/O for server components](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCDocumentOperationsFileIOInternal/index.md) `MFiles.IRPCDocumentOperationsFileIOInternal`
- **gRPC method:** `/MFiles.IRPCDocumentOperationsFileIOInternal/UploadFileCommit2`
- **HTTP (mf-http-grpc):** `POST /grpc/v1/upload-file-commit2`
- **Request:** [`UploadFileCommit2Request`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCDocumentOperationsFileIOInternal/UploadFileCommit2/index.md#request)
- **Response:** [`UploadFileCommit2Response`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCDocumentOperationsFileIOInternal/UploadFileCommit2/index.md#response)
- **Book and level:** Server integration API, specialized
- **Kind:** write
- **Session:** Required: a session (mfiles-session-id-bin metadata) or a session assertion (x-mf-session-assertion metadata).
- **Idempotent:** no
- **Returns metadata structure version:** yes (in the mfiles-metadata-version-bin trailer)
- **Streaming:** none (unary)

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

## Remarks

**For M-Files components only.** M-Files Server calls it on another M-Files Server to forward
[UploadFileCommit](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCObjectOperations/UploadFileCommit/index.md). Applications should call
`UploadFileCommit`.
- Changes the file content of the object. The checks are those of `UploadFileCommit`: the object
  must be checked out to the caller, and the caller needs edit access to it.
- Unlike `UploadFileCommit`, it does not fill in unset file times and returns no object version
  information.
- Requires a vault session of a login that has a user account in the vault.

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

## Request: UploadFileCommit2Request

> 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` | The ID from [UploadFile](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCObjectOperations/UploadFile/index.md). |
| `obj_id` | [`ObjID`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.ObjID/index.md) | The object that owns the file. |
| `obj_id.type` | `int32` | The object type ID, for example 0 for documents. In a lookup value, the value list ID (for a lookup to objects, the object type ID). |
| `obj_id.item_id` | [`ItemID`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.ItemID/index.md) | The ID of the object within its type, in `item_id.internal_id`. |
| `obj_id.item_id.internal_id` | `int32` | The ID of the object or value list item. |
| `obj_id.item_id.external_repository_id` | [`ExternalRepositoryID`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.ExternalRepositoryID/index.md) | Used only for objects in external repositories (external connectors). Leave it unset for objects stored in the vault. |
| `file` | [`File`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.File/index.md) | The file and its new size. `title`, `extension` and `allocation_size` are ignored. |
| `file.file_ver` | [`FileVer`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.FileVer/index.md) | The file and its version. Pass it unchanged in an `ObjFileVer` to download the file. |
| `file.file_ver.file_id` | [`FileID`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.FileID/index.md) | The file. |
| `file.file_ver.type` | [`FileVerType`](https://developer.m-files.com/APIs/gRPC-API/Reference/Enums/MFiles.FileVerType/index.md) | `FILE_VER_TYPE_SPECIFIC` for a file version number. Values: `FILE_VER_TYPE_UNINITIALIZED` (0), `FILE_VER_TYPE_LATEST` (1), `FILE_VER_TYPE_ANY` (2), `FILE_VER_TYPE_SPECIFIC` (3). |
| `file.file_ver.internal_version` | `int32` | The file version number. |
| `file.file_ver.external_repository_version` | `string` | Used only for files in external repositories. Leave empty. |
| `file.file_ver.external_repository_sort_key` | `int64` | Used only for files in external repositories. Leave 0. |
| `file.title` | `string` | The file name without the extension. |
| `file.extension` | `string` | The file name extension without the dot, for example "pdf". |
| `file.size` | `int64` | The size of the file in bytes. Exact when `size_precision` is `FILE_SIZE_PRECISION_EXACT`. |
| `file.size_precision` | [`FileSizePrecision`](https://developer.m-files.com/APIs/gRPC-API/Reference/Enums/MFiles.FileSizePrecision/index.md) | How exact `size` is. Do not rely on `size` if it is `FILE_SIZE_PRECISION_UNKNOWN`. Values: `FILE_SIZE_PRECISION_EXACT` (0), `FILE_SIZE_PRECISION_ESTIMATE` (1), `FILE_SIZE_PRECISION_UNKNOWN` (2). |
| `file.created_at_utc` | [`google.protobuf.Timestamp`](https://protobuf.dev/reference/protobuf/google.protobuf/#timestamp) | The time in UTC the file was originally created. |
| `file.accessed_at_utc` | [`google.protobuf.Timestamp`](https://protobuf.dev/reference/protobuf/google.protobuf/#timestamp) | The time in UTC the file was last accessed (e.g. read). |
| `file.written_at_utc` | [`google.protobuf.Timestamp`](https://protobuf.dev/reference/protobuf/google.protobuf/#timestamp) | The time in UTC the file was last written to. |
| `file.changed_at_utc` | [`google.protobuf.Timestamp`](https://protobuf.dev/reference/protobuf/google.protobuf/#timestamp) | The time in UTC the file was last written to or its attributes were changed. |
| `file.guid` | `string` | GUID of the file. |
| `file.md5_checksum` | `string` | The MD5 checksum of the file as 32 lowercase hexadecimal digits, if available. |
| `file.is_missing` | `bool` | True, if the file is missing. |
| `file.is_content_volatile` | `bool` | True, if the file physical content is volatile. I.e. the physical content can change without the version number change, as long as the logical content is same. The file content is guaranteed to stay physically consistent within single download session only. |
| `file.flags` | [`OBJECTFILEFLAGS`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.OBJECTFILEFLAGS/index.md) | Object file flags. |
| `file.flags.all` | `bool` | Specifies all flags set; Including any future flags. |
| `file.flags.can_be_edited_externally` | `bool` | Next available value. |
| `file.master_storage_file_ref` | `string` | An optional File reference (GUID) to external Master Storage API. Only used with Master Storage, otherwise empty. |
| `low_digest` | `int64` | If not zero, specifies the low-order part of the MD5 checksum of the uploaded file. |
| `high_digest` | `int64` | If not zero, specifies the high-order part of the MD5 checksum of the uploaded file. |

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

## Response: UploadFileCommit2Response

> 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 |
|---|---|---|
| `data_file_version` | `int32` | The version of the stored data file of the new file content. |

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

## Related methods

- [IRPCObjectOperations.UploadFileCommit](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCObjectOperations/UploadFileCommit/index.md): Completes an upload made with UploadFile and stores it as the new content of the file.
