IRPCObjectOperations.UploadTempFile

View as Markdown

Vault API / core write session or assertion idempotent

Uploads a block of a file to a temporary upload session on the server. The upload can then be used as the content of a new object.

ServiceObjects, versions, properties and files MFiles.IRPCObjectOperations
gRPC method/MFiles.IRPCObjectOperations/UploadTempFile
HTTP (mf-http-grpc)POST /grpc/v1/upload-temp-file
RequestUploadTempFileRequest
ResponseUploadTempFileResponse
Book and levelVault API, core
Kindwrite
SessionRequired: a session (mfiles-session-id-bin metadata) or a session assertion (x-mf-session-assertion metadata).
Idempotentyes
Returns metadata structure versionno
Streamingnone (unary)

Remarks

Upload a file in one or more calls:

  1. The first call has upload_id 0, offset 0 and the total_size_in_bytes of the file. It returns the new upload_id.
  2. Further calls pass that upload_id and the offset of their block.
  3. UploadTempFileCommit completes the upload.

The committed upload can be used by AddObjectWithFiles (files with OBJ_FILE_SOURCE_TYPE_UPLOADED_FILE or ..._UPLOADED_FILES and the upload_id), which consumes it, and by DownloadTempFileFromUpload_Begin and GetTextContentForTemporaryFile. An upload that is not committed cannot be used ("The process cannot access the file because it is being used by another process.").

Session. The upload belongs to the calling login session, on the server that received the first block; another login session gets "Not found. (The specified upload session <id> does not exist.)". An upload that is not used for about 10 minutes (server default) is removed: call KeepUploadSessionAlive at the interval given in SessionData.keep_upload_session_alive_interval_in_seconds if you keep it longer. Remove uploads you do not use with RemoveUploadSession. Anonymous sessions cannot upload.

Each request is limited by the server's maximum gRPC message size (48 MiB by default).

Request: UploadTempFileRequest

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

FieldTypeDescription
upload_idint320 to start a new upload; the returned ID for the following blocks.
total_size_in_bytesint64The size of the whole file. Read only in the first call.
offsetint64The position of this block in the file. Must be 0 in the first call. Use multiples of 4096 bytes for all blocks but the last.
databytesThe bytes of this block.
temp_extensionStringValueThe file name extension of the upload, without the dot (for example "pdf"). Set it in the first call. DownloadTempFileFromUpload_Begin returns it as file_extension.
temp_extension.valuestringString.

Response: UploadTempFileResponse

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

FieldTypeDescription
upload_idint32The ID of the upload.