Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

187
Views
Upload field that is fully managed by JavaScript (no upload to a server)

I want to add an import functionality to a SAPUI5 application. I don't need to upload the file to a server, since I only want to handle the file on the client-side. The FileUploader control that is supplied with SAPUI5 doesn't seem to support that.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

One can disable the automatic upload by not setting the uploadOnChange property to true, and then adding a change handler to the control. The change handler has access to the uploaded files via oEvent.getParameters().files, and can process the uploaded files. When the form that is inside the FileUploader control is never submitted, it won't try to upload the files.

<mvc:View
    controllerName="app.controller.Main"
    xmlns="sap.m" xmlns:mvc="sap.ui.core.mvc" xmlns:unified="sap.ui.unified"
    displayBlock="true">
    <Shell id="shell">
        <App id="app">
            <pages>
                <Page id="page" title="{i18n>title}">
                    <content>
                        <unified:FileUploader id="ui5-uploader"/>
                    </content>
                </Page>
            </pages>
        </App>
    </Shell>
</mvc:View>
sap.ui.define([
    "sap/ui/core/mvc/Controller"
], function (Controller) {
    "use strict";

    return Controller.extend("app.controller.Main", {
        onAfterRendering: function() {
            var uploader = this.getView().byId("ui5-uploader");
            uploader.attachChange(function(oEvent) {
                oEvent.getParameters().files[0].text().then(
                    function(sContent) {
                        console.log(sContent);
                    }
                );
            });
        }
        
    });
});
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!