cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to set UploadUrl of uploadcollection in code

0 Kudos

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);

Accepted Solutions (0)

Answers (1)

Answers (1)

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);