This document will give you in details all the necessary steps (Backend and Frontend) to use easily the file upload feature in your SAP SAPUI5 apps.
Use the Data Dictionary tool (SE11) to prepare a new DD structure for the entity type to be created for uploading files
The Goal in the given example is to upload a file for workflow task and the workitem ID is used as one of the keys for the new file
Create a new entity type that refers the dictionary structure created in step 1 and flag the media checkbox
Import the entity type properties from the dictionary structure if not done during entity type creation
Redefine the standard method called DEFINE as below to declare your mime type property as content type for the new entity. In this provided example the property is called “Mimetype”
For reuse purposes, you can define a dialog in a XML fragment to be called from the view
After preparing all the frontend elements, you need to redefine the method CREATE_STREAM Of the generated class DPC_EXT
The above code will allow you to read the parameters sent in the request header (like workitemid in the provided example)
After you can decode the base64 content to a xstring data and handle your content as you wish . In the provided example, I am using a home made function to transform the base64 to a xstring to be stored in SAP DMS later.