cancel
Showing results for 
Search instead for 
Did you mean: 

Converting file upload to base64 - SAPUI5

0 Kudos

Hi,

In UI5, I am trying to use FileUploader UI control.

I need to convert the file data to base64.

Could anyone help.

Regards,

Samad

Accepted Solutions (1)

Accepted Solutions (1)

CristianBabei
Contributor

You want to convert it, on backend or frontend?

If in backend, there are alot of FM to convert it.

If in frontend, you can on the event change of the fileuploader , read the fileuploader content like this:

 onChangeFileUploader : function(oEvt){
        var aFiles=oEvt.getParameters().files;
        var currentFile = aFiles[0];

Now with the file, use JS or JQuery to manipulate 🙂

0 Kudos

Thank you for that Cristian!.

0 Kudos

Hello Cristian,

I have tried this, however, I get an error "Cannot read properties of undefined (reading '0')" on the line

"var currentFile = aFiles[0];

Could you please help me with this.

Answers (0)