Skip to main content

core.medplumclient.uploadmedia

Home > @medplum/core > MedplumClient > uploadMedia

MedplumClient.uploadMedia() method

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

ParameterTypeDescription
contentsstring | Uint8Array | File | BlobThe contents of the media file, as a string, Uint8Array, File, or Blob.
contentTypestringThe media type of the content.
filenamestring | undefinedThe name of the file to be uploaded, or undefined if not applicable.
additionalFieldsPartial<Media>(Optional) Additional fields for Media.
optionsMedplumRequestOptions(Optional) Optional fetch options.

Returns:

Promise<Media>

Promise that resolves to the created Media