# Upload a file

## Overview

[Video: Upload a file](https://www.youtube.com/watch?v=wa9O0X-NpqI)

This flow describes how to upload one or more [files](https://docs.ohc.network/concepts/clinical/files.md) from your device to a patient or to an encounter in Care.

To upload a photo from your camera or an audio recording, see [Take a photo and upload it](https://docs.ohc.network/flows/clinical/files/take-a-photo.md) and [Record audio and upload it](https://docs.ohc.network/flows/clinical/files/record-audio.md).

## Pre-requisites

* The patient is registered in Care, and you can open the patient's page or the encounter.

* Each file is not larger than 100 MB.

* Each file has an extension that Care accepts. With the default settings, Care accepts files with these extensions, shown here by **File Type**:

  <!-- -->

  * Image: .jpg, .jpeg, .png, .gif, .bmp
  * Video: .mp4, .mov, .avi, .wmv, .ogg
  * Audio: .mp3, .wav
  * Document: .pdf
  * Other: .txt, .csv, .rtf, .doc, .odt, .xls, .xlsx, .ods
  * Care also checks the file type that the browser reports, and some browsers report a type that Care refuses. For example, in Chromium on macOS, .rtf and .avi files fail with an error that contains "Invalid mime type". If this happens, use another format, such as .pdf or .mp4.

* Care does not accept Word documents in the .docx format. Care accepts Word documents in the .doc format. Save a .docx document as .doc or .pdf before you upload it.

* Care does not accept PowerPoint .pptx files. By default, Care does not accept .tiff images.

* If you upload to an encounter, you opened the encounter from a facility. Outside a facility, for example from an organization, the encounter's **Files** tab is read-only.

* If you upload to an encounter, you look at the encounter that you opened, not another encounter of the patient.

* If you upload to an encounter, its status is not Completed, Cancelled, Entered in error or Discontinued.

* If you upload to an encounter, the encounter workspace layout does not hide the **Files** tab.

* You have the permissions listed below.

## Permissions

| Permission | Access |
| - | - |
| Can Update a Patient's data | Upload files to the patient. Care shows **Add Files** on the patient's **Files** tab only with this permission. Hold it through [a role on the patient](https://docs.ohc.network/concepts/clinical/files.md#permissions). By default, Staff, Doctor, Nurse, Administrator and Facility Admin hold it. |
| Update Encounter related clinical data | Upload files to an encounter. Hold it in a [department](https://docs.ohc.network/concepts/facility/department.md) of the encounter or of its current location. Nobody can upload files to a closed encounter. By default, Doctor, Nurse and Facility Admin hold it. |
| Update Encounter non clinical | Care shows **Add Files** on the encounter's **Files** tab only with this permission. Hold it through a role on the encounter. By default, Doctor, Nurse and Facility Admin hold it. |
| Can view clinical data about patients | Shows the patient's **Files** tab and lists the patient files. Also shows the encounter's **Files** tab. Hold it through [a role on the patient](https://docs.ohc.network/concepts/clinical/files.md#permissions). By default, Staff, Doctor, Nurse and Facility Admin hold it. |
| Can Read encounter related clinical data | Shows the encounter's **Files** tab and lists the encounter files. Hold it in a department of the encounter or of its current location. By default, Doctor, Nurse and Facility Admin hold it. |

Note: By default, the Administrator role holds "Can Update a Patient's data" but not "Can view clinical data about patients". So a user who has only the Administrator role cannot open the patient's **Files** tab, and cannot upload files there.

## Steps

### 1. Open the Files tab

To upload to the patient, open the patient's page. Select the **Files** tab.

To upload to an encounter, open the encounter. Select the **Files** tab, or press `g` and then `f`.

Care opens the **Files** sub-tab. The **Reports** sub-tab next to it holds generated reports, not uploaded files.

![The Files tab of the Patient Details page, with Search files, Status and Add Files](/assets/images/upload-a-file-1-626ee585a65683a2e797d94a5d686a99.webp)

### 2. Choose the files

Select **Add Files**.

If you do not see **Add Files**, you cannot upload files here. Check the pre-requisites and the permissions.

Select **Upload From Device**. The file picker of your device opens.

Select one or more files. The file picker shows only the accepted file types, and also .tiff images.

Care opens the upload dialog. Its title is **Upload File** for one file, or **Upload Files** for more than one file.

![The Add Files menu with Upload From Device, Open Camera and Record Audio](/assets/images/upload-a-file-2-b3c241b016c453a21fb2e495451c6f82.webp)

### 3. Name each file

Enter a name in the **File Name** field of each file. The field is required.

The field starts empty. Care does not copy the name that the file has on your device.

The **Files** list shows the name that you enter, followed by the extension of the file.

Each image shows a small preview.

To leave out a file, select the remove (X) button next to it.

To stop without uploading, select **Discard**. Care removes the chosen files and closes the dialog.

![The Upload File dialog with a preview of the image and Chest X-ray in the File Name field](/assets/images/upload-a-file-3-bdf8cd1e8be9c9e8c5eee5d5dab0ce59.webp)

### 4. Combine images into one PDF (optional)

If you chose more than one file, the dialog shows **Combine Files To PDF**.

Select **Combine Files To PDF** to upload all the files as one PDF file.

This works only when each file is a .jpg, .jpeg or .png image. For other file types, Care shows "Invalid file type".

When you select it, the dialog shows one **File Name** field for the PDF. Enter a name for the PDF.

### 5. Upload the files

Select **Upload**.

If you combine the files, Care shows **File conversion in progress** and then **File conversion successful**.

Care shows "Uploading…", the percentage, and a progress bar. Care uploads the files one after the other.

You cannot close the dialog while Care uploads the files. **Discard** and **Upload** are not available until Care finishes.

If Care shows one of these messages, do the action in the table.

| Message | What to do |
| - | - |
| **Maximum size of files is 100 MB** | A file is larger than 100 MB. Remove that file. |
| "Invalid file type", followed by the extension and the accepted types | Remove the file that has that extension. If **Combine Files To PDF** is selected, clear it, or keep only .jpg, .jpeg and .png files. |
| **Please give a name for the file** | Enter a name in each empty **File Name** field. |
| **Failed to generate PDF** | Upload the images as separate files, without **Combine Files To PDF**. |
| **Error Uploading File: Network Error** | Care shows this in the dialog for each file that failed, for any reason. The failed files stay in the dialog. Care puts the original file names in their **File Name** fields. Remove any .tiff file, because Care does not accept it by default. Enter your names again. Select **Upload**. |
| "Error Uploading File:", followed by another reason | The storage refused the content of the file. The dialog also shows **Error Uploading File: Network Error** for that file. If the message shows again after you select **Upload**, tell your administrator. |

![The Upload button in the Upload File dialog](/assets/images/upload-a-file-4-6bad75be07b44cb7d63566706184f66e.webp)

![The message File Uploaded Successfully, and Chest X-ray.jpg in the Files list](/assets/images/upload-a-file-5-84e0d808ad912f329b4bf0ef314932d9.webp)

## Expected Outcome

* Care shows **File Uploaded Successfully** for each file that it uploads.
* When all the files are uploaded, Care closes the dialog and refreshes the list.
* The new files are at the top of the list, unless the search text or the **Status** filter hides them.
* **Shared By** shows your name, and **Date** shows the upload date.
* A file that you upload on an encounter shows only on the **Files** tab of that encounter. A file that you upload on the patient's **Files** tab does not show on an encounter.

## Related

Concepts:

* [Files](https://docs.ohc.network/concepts/clinical/files.md)

Flows:

* [Find a file](https://docs.ohc.network/flows/clinical/files/find-a-file.md)
* [Take a photo and upload it](https://docs.ohc.network/flows/clinical/files/take-a-photo.md)
* [Record audio and upload it](https://docs.ohc.network/flows/clinical/files/record-audio.md)
* [View or preview a file](https://docs.ohc.network/flows/clinical/files/view-or-preview-a-file.md)
* [Rename a file](https://docs.ohc.network/flows/clinical/files/rename-a-file.md)
* [Archive a file](https://docs.ohc.network/flows/clinical/files/archive-a-file.md)
