on 04-23-2015 2:00 PM
Dear All,
Kindly help to find out a way to add additional request parameters (SLUG) while uploading a file from UI5 front end through gateway using Sap.M.UploadCollection control before uploading the file.
insertCollectionParameter is working but i would like to add dynamic parameters before the POST request is fired.
Kindly help accordingly.
Thanks,
Rumeshbabu S
Hi,
slug is one of the header parameters, if you want to add multiple values i suggest you use a separator, e.g. "|" so you can easily split the parameters in the backend.
e.g.
var oHeaders = {
"x-csrf-token" : header_xcsrf_token,
"slug" : sap.ui.getCore().byId('masterSelect')
.getSelectedKey()
+ "|"
+ file.name
+ "|"
+ file.type
+ "|"
+ sap.ui.getCore().byId('bestandsNaam').getValue()
+ "|"
+ sap.ui.getCore().byId('typeSelect')
.getSelectedItem().getId(),
};
if you want something dynamic, you could use a javascript array:
var slug = slugArray.join("|");
in backend:
CONSTANTS:
gc_delimiter(1) TYPE c VALUE '|'.
SPLIT iv_slug AT gc_delimiter into itab_slug.
Kind regards,
RW
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Robbe,
But I would like to add the header to uploadcollection control during at the time of selecting the file or before the POST is fired, Since this control immediately fire the POST once the file is selected.
Typically i am looking for an event which gets triggered before the file is uploaded, like sap.ca.ui.FileUpload.beforeUploadFile.
So that i can add my additional parameters on that event.
Regards,
Rumeshbabu S
Many Thanks Robbie,
The event "change" is getting executed the once the file is selected from the open file dialog & all the details related to the selected files (FileName, FileType etc ) are coming as event parameters.
With sap.m.addHeaderParameter i think we can pass "slug" parameters as you suggested to get the additional parameters in the backend.
Regards,
Rumeshbabu S
do you need HTTP header parameters ?
UploadCollection._getFileUploader().addHeaderParameters( new sap.ui.unified.FileUploaderParameter(
{
name : "NAME",
value : "VALUE"
}
) );
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.