core.medplumclient.uploadmedia | Medplum

MedplumClient.uploadMedia() method

Warning: This API is now obsolete.

Use createMedia with CreateMediaOptions instead. To be removed in a future version.

Upload media to the server and create a Media instance for the uploaded content.

Signature:

uploadMedia(contents: string | Uint8Array | File | Blob, contentType: string, filename: string | undefined, additionalFields?: Partial<Media>, options?: MedplumRequestOptions): Promise<Media>;

Parameters [​](/content/docs/sdk/core.medplumclient.uploadmedia#parameters "Direct link to Parameters"/index.html)

Parameter Type Description
contents string The contents of the media file, as a string, Uint8Array, File, or Blob.
contentType string The media type of the content.
filename string Optional filename for the binary, or extended upload options (see BinaryUploadOptions).
additionalFields Partial (Optional) Additional fields for Media.
options MedplumRequestOptions (Optional) Optional fetch options.

Returns:

Promise

Promise that resolves to the created Media