cancel
Showing results for 
Search instead for 
Did you mean: 

UploadCollection not sending Headers (XSRF)

kammaje_cis
Active Contributor
0 Kudos

Hi all,

I am using UploadCollection for file upload.

My XML View looks like this


<IconTabFilter id="iconTabFilter3" text="Attachments" icon="sap-icon://attachment-photo">

   <content>

      <UploadCollection id="UploadCollection" maximumFilenameLength="55" multiple="true" items="{/CreateAttachmentSet}" showSeparators="None" fileDeleted="onFileDeleted" fileRenamed="onFileRenamed" uploadComplete="onUploadComplete" uploadUrl="{path:'Aufnr', formatter: 'ZServiceOrderDetail.util.Formatter.uploadUrl'}">

         <UploadCollectionItem contributor="{CreateName}" documentId="{Item}" fileName="{path: 'Item', formatter: 'ZServiceOrderDetail.util.Formatter.fileName'}" mimeType="{MimeType}" uploadedDate="{CreateDate}" url="{parts:['Aufnr', 'Item'],                      formatter:'ZServiceOrderDetail.util.Formatter.downloadUrl'                 }" enableEdit="false" visibleEdit="false" enableDelete="true" />

         <headerParameters>

            <UploadCollectionParameter name="x-csrf-token" value="xyz" />

         </headerParameters>

      </UploadCollection

   </content>

</IconTabFilter>

As you can see I am sending a dummy csrf token here. In the controller, I get the token and set the value.

When I see the request header, I do not see the header. Atleast the dummy FXRF token should have been sent?

Thanks

Krishna

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello Krishna,

I am experiencing the exact same behaviour for the UploadCollection Control where headers are not passed with the request although i`m setting them in the view of the control in the headerParameters Aggregation.

Did you find a solution for this?

with best regards

Florian Hafner

former_member187227
Participant
0 Kudos

Hope this will help you try it.

former_member182372
Active Contributor
0 Kudos

  /**

  * The event is triggered when files are selected. Applications can set parameters and headerParameters which will be dispatched to the embedded FileUploader control.

  * Parameters and headerParameters are not supported by Internet Explorer 9.

  */

  change : {

var fnChange = function(oEvent){

  oUploadCollection.addHeaderParameter(new sap.m.UploadCollectionParameter({ name : "x-csrf-token", value : "xyz"}));

};

var oUploadCollection = new sap.m.UploadCollection({

...

change : fnChange,

...

});