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
Parameter | Type | Description |
---|---|---|
contents | string | Uint8Array | File | Blob | The contents of the media file, as a string, Uint8Array, File, or Blob. |
contentType | string | The media type of the content. |
filename | string | undefined | The name of the file to be uploaded, or undefined if not applicable. |
additionalFields | Partial<Media> | (Optional) Additional fields for Media. |
options | MedplumRequestOptions | (Optional) Optional fetch options. |
Returns:
Promise<Media>
Promise that resolves to the created Media