Skip to Content
avatar image
Former Member

Issue With sap.ui.core.util.File.save

Hello Developers,

We have an issue with Chrome & UI5's sap.ui.core.util.File.save() function. We have a model with some string data we want to download. The User clicks a button and we fire an event, which uses the sap.ui.core.util.File.save() function to download the file locally.

The problem is when a user has the option in Chrome which asks the user where to save files set to true, and the user clicks cancel, we have already executed our function which saves the file. All the usage of sap.ui.core.util.File.save() is in the onPress of the button and as such we currently have no way of knowing if the User clicked cancel in the Chrome popup asking for the save file location.

I understand this is not an issue with UI5 persay but has anyone any ideas on how to approach this or already solved this same issue?

Please if you need any more information or some useful material, dont hesitate to post it.

Our on press currently looks something like this :

onDownloadPress : function(oEvent){
   //Create var With String Data From Model Attribute
   var sFileContent = this.getModel("sModelName").getObject("sFileContent");
   //User UI5 File.save() funciton to create local file.
   sap.ui.core.util.File.save(sFileContent, sFileName, sFileType, null, null);
}

Just to clarify the current problem we expierence, when cancel is selected, the File.save() is called but the path (Where the file should be saved locally) is empty.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers