cancel
Showing results for 
Search instead for 
Did you mean: 

How to pass arguments to CREATE_STREAM via Slug parameters ?

former_member185620
Participant
0 Kudos

Hi everyone, I follow the steps in the and .

I want to pass many arguments to create_stream via slug parameters?

I use the following code in SAPUI5.


var oFileUploader = new sap.ui.unified.FileUploader({

                    uploadUrl : "/sap/opu/odata/sap/ZFILE_UPLOAD_TEST_SRV/UserCollection('"+ "burak.oral" +"')/Photo",

                    name: "simpleUploader",

                    uploadOnChange: false,

                    sendXHR: true,

                    maximumFileSize : 1,

                    useMultipart: false,

                    headerParameters: [

                        new sap.ui.unified.FileUploaderParameter({name: "x-csrf-token", value: sap.ui.getCore().getModel().getHeaders()['x-csrf-token'] }),   

                    ],

                    uploadComplete: function (oEvent) {

                        var sResponse = oEvent.getParameter("response");

                        if (sResponse) {

                            oUploadDialog.close();

                            sap.ui.commons.MessageBox.show("Return Code: " + sResponse, "Response", "Response");

                        }

                    }                   

                });

How to do pass paramater for above code.

Best Regards,

Burak Oral

Accepted Solutions (1)

Accepted Solutions (1)

mauriciolauffer
Product and Topic Expert
Product and Topic Expert
0 Kudos

You can use the component sap.ui.unified.FileUploaderParameter to pass a slug.

But you have only one slug per Upload. So, you need to concatenate your data using some separator defined by yourself.

In the example below I used a pipe character, "I", as separator:


oHeaderParameter = new sap.ui.unified.FileUploaderParameter({

  name : "slug",

  value : "argument1|argument2|argument3"

});

oFileUploader.addHeaderParameter(oHeaderParameter);

Now, you just need to make your own logic to extract and split the SLUG in many values on SAP Gateway.

Hope it solve your problem.

0 Kudos

Thank You very much Mauricio - this came very handy for me!

Answers (0)