Forum

Dinkel
Moderator
    Has successfully completed the online course Introduction
    Has successfully completed the online course Intermediate (200)
    Has successfully completed the online course Advanced (300)
    Has successfully completed the online course Basics (100)
6 years, 3 months ago #18072
Up
0
Down
::

You try the following:
Add a button (sap.m.Button) and add the following to the press event like you did in a post above.

var fileUploader = $(‘#Create_Image–ui_unifed_FileUploader-fu’);
if (fileUploader !== null)
fileUploader.click();

Then add to the onAfterRendering of your screen the following code:

$(‘#Create_Image–ui_unifed_FileUploader-fu’).change(function() {
$(‘#Create_Image–ui_unified_FileUploader1-fu_form’).submit();
});

Now hide the button with a CSS rule which says

display: none;

Now you can trigger the hidden button with

sap.ui.getCore().byId(“Id_Of_The_Button”).firePress()

On this way the file chooser will appear automatically.

@jonas.rausch You can’t fire the press event on this way because she uses sap.ui.unified.FileUploader which is a form with an input of type file.