Wiki Spaces


Get Help from Others

Q&A: Ask OpenMRS
Discussion: OpenMRS Talk
Real-Time: IRC Chat | Slack


Page tree
Skip to end of metadata
Go to start of metadata

Upload and View/Download Image/File in HTMLForm Entry Module

Primary mentor

Saptarshi Purkayastha

Backup mentor

Assigned to


Background: It is important to load images or other files (such as Excel spreadsheets generated during EBRT - External Beam radiation Therapy or Brachytherapy based Oncology treatments) with patients clinical record.
We are proposing this project so that, the implementers while developing the HTML Forms using the HTMLForm entry module can provide a file upload button to the data entry user. Consequently, when the user load a file/image while doing data entry for an encounter, those files should be stored in the server so that they are available to be viewed/downloaded by other users.

Project Champions

Implementation : MissionArogya - ArogyaNet

Rajib Sengupta



Provide a “Tag”, say “Upload File” or “browse” in the HTMLFormEntry module to upload file. It will show up as a button to upload file.


When the data entry user (the clinician), will enter data for an encounter, they will be provided with this button in the form. While clicked on that button, it will open a file explorer pop-up window. The user can go to his/her desktop/network to locate the file and load it. When the file is loaded it can be stored in the database or as a file in the server itself.

3.View or Download:

In the Encounter lists of the Patient add another icon next to the “Edit” and “View” icon as the “File Uploaded” icon. While clicked on that it should open up another UI (or pop-up) with links to all the files that are attached to that specific encounter. WHile clicked on that link, either the file will be opened or can be downloaded.

OR The file link can be inside the HTML Form itself, as a "Link" . WHile clicked on that link, either the file will be opened or can be downloaded.

Extra Credit


  • No labels


  1. Hello! I am interested in this project. Below is my objectives aligned with how I understand the project. Please do correct me if I am far off the objectives of the project.

    Project Objectives

    •Create a ‘choose file’ and ‘upload file’ button with HTML form that lets users select a file to upload and upload the file which will be posted to the server.

    •Move the uploaded file from a temporary storage area on the server to a more permanent location by saving it with the $_FILES associative array.

    •Check that no errors occurred during upload and read file from the server. Create a ‘File uploaded’ in a form that will open another UI with links to all the files that are attached to that specific encounter. The files will be opened when their links are clicked on.

    1. The project is an enhancement to the HTMLFormEntry module which is used for creating forms that are filled for data entry into OpenMRS. HTMLFormEntry contains tags that generate underlying schema for OpenMRS through which data is saved into the different OpenMRS tables such as encounters-obs etc.

      Basically Obs can be of different value types such as NUMERIC, CODED, BOOLEAN etc. These are the values are actual answers to questions that are filled into the forms for a patient. Thus, for a concept WEIGHT  the answer will be a NUMERIC type and value will can be say. e.g. 60. This is currently created nicely through the <obs> tag and the different concept value type automatically creates the view. e.g for numeric it will create a field that can take numeric values. For CODED, it will show a dropdown of possible answers.

      For this project, you can take two approaches. Either create a new tag <obsImg> that will let you upload an image into a form when filling the form and view the uploaded image when view the observations. There is already an ImageHandler class for the ComplexObs that lets you do this. But that needs to be integrated with the HTMLFormEntry module. The other possibility is to make the <obs> tag understand that when the concept's value type is COMPLEX, that time it needs to contain a required attribute to the tag called say. e.g. <obs concept="110" handler = "ImageHandler"> and this will use the ImageHandler class and on the view will display an upload/view in the HTMLFormEntry. 

      I suggest that you do a lookup for HTMLFormEntry tags, ComplexObs, ImageHandler on the OpenMRS wiki and ask questions if you have some problems understanding these things. 

      1. Hi Saptarshi for me the way i understand this its like this enhancement enable us to

        capture patients image etc.. enlighten me if am wrong

        kind regards mago..

  2. user-07d6f

    I would like to make the comment that you may be able to approach the problem of storing data about radiotherapy/brachytherapy in a more productive manner. The items produced (i.e., DICOM-RT files) can be saved in a PACS (as can images, and videos). I understand the problems of having a DICOM-RT viewer, but that aside would it not make more sense to find a PACS (e.g., Dicoogle) to 'marry' to OpenMRS so that all the imaging modalities can be stored in a consistent manner?


  3. user-bbc60

    I am interested in taking up this project if it's still available to be developed or updated?