cancel
Showing results for 
Search instead for 
Did you mean: 

openUI5 fileUploader status after upload

Flavio
Active Contributor

Hi Experts,

I've taken the fileUploader Complex sample from the documentation, here, and having added an extra Input control in the view, how could I check that the upload was successful and then set the uploaded filename into the added Input control?

I was checking the Controller.controller.js code and the handleCompleteUpload function:

sap.ui.define(['sap/m/MessageToast','sap/ui/core/mvc/Controller'],
    function(MessageToast, Controller) {
    "use strict";

    return Controller.extend("sap.ui.unified.sample.FileUploaderComplex.Controller", {
        handleUploadComplete: function(oEvent) {
            var sResponse = oEvent.getParameter("response"),
                iHttpStatusCode = parseInt(/\d{3}/.exec(sResponse)[0]),
                sMessage;

            if (sResponse) {
                sMessage = iHttpStatusCode === 200 ? sResponse + " (Upload Success)" : sResponse + " (Upload Error)";
                MessageToast.show(sMessage);
            }
        },

and noticed in debugging that the sResponse is undefined;

while checking the doc, it says

has to be put within the "body" tags of the response document of the 
iFrame. It can consist of a return code and an optional message. This 
does not work in cross-domain scenarios.

is there any alternative method to check a successful upload?

Many thanks for any help about this

With Best Regards,

Flavio

Accepted Solutions (0)

Answers (0)