core.medplumclient.uploadmedia
Home > @medplum/core > MedplumClient > uploadMedia
MedplumClient.uploadMedia() method
Warning: This API is now obsolete.
Use
createMediawithCreateMediaOptionsinstead. To be removed in Medplum 4.0.
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  | Optional filename for the binary, or extended upload options (see   | 
additionalFields  | Partial<Media>  | (Optional) Additional fields for Media.  | 
options  | (Optional) Optional fetch options.  | 
Returns:
Promise<Media>
Promise that resolves to the created Media