Skip to Content

Unable to set UploadUrl of uploadcollection in code

The setUploadUrl method does not work, when I used it I found that the url is still a default one i.e " ../../../upload", then I tried to build a model on the controller with a url and pass it to the uploadCollection in this way:

On the view I bound the uploadUrl property to the model:

uploadUrl="{/uploadURL/path}

On the controller I instatiated a model and set it to the uploadCollection, I have tried setting the model inside the onChange event of the uploadCollection and also outside it, even though the uploadCollection got the model the url still was the default one:

var oData = {

uploadURL: {

path: "my Server Url/my service/Applications('" +parameter1 + "','" + parameter2 + "')/App_Attachments"

}

};

var oModel1 = new JSONModel(oData);

var oUploadCollection = this.getView().byId("UploadCollection");

oUploadCollection.setModel(oModel1);

Add comment
10|10000 characters needed characters exceeded

1 Answer

  • Posted on Aug 30, 2016 at 02:18 PM

    I found the solution to this problem. I used setProperty in the ff way:

    var url = "my Server Url/my service/Applications('" +parameter1 + "','" + parameter2 + "')/App_Attachments";

    oUploadCollection.setProperty("uploadUrl", url);

    Add comment
    10|10000 characters needed characters exceeded