Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 2638

FileUploader - 405 Method Not Allowed

$
0
0

Hello Experts,

 

I've followed the excellent set of blogs by Peter Marcely regarding SAPUI5 & Gateway attachments.

 

I would like to implement file uploading without entities associations.

 

The code is from this blog:

http://scn.sap.com/community/developer-center/front-end/blog/2014/07/28/upload-image-to-sap-gateway-and-display-image-in-ui5--using-new-fileuploader-with-sap-gateway

 

var oFileUploader = new sap.ui.unified.FileUploader({      uploadUrl : "/sap/opu/odata/sap/<service>/AttachmentCollection('1')/$value",          name: "simpleUploader",           uploadOnChange: false,          sendXHR: true,          useMultipart: false,          headerParameters: [              new sap.ui.unified.FileUploaderParameter({name: "x-csrf-token", value: sCSRF })        ],          uploadComplete: function (oEvent) {              var sResponse = oEvent.getParameter("response");                  if (sResponse) {                      sap.ui.commons.MessageBox.show("Return Code: " + sResponse, "Response", "Response");          }          }                      
});  
// create a button to trigger the upload  
var oTriggerButton = new sap.ui.commons.Button({      text:'Upload',          press:function() {          // call the upload method          oFileUploader.insertHeaderParameter(new sap.ui.unified.FileUploaderParameter({name: "slug", value: oFileUploader.getValue() }));                oFileUploader.upload();          }  
});  

The problem is that I'm getting '405 Method Not Allowed' when running from SAPUI5 (the method is automatically set to POST).

 

If I run this from gateway client and add a file, the method changes to PUT and it works.

 

Both create_stream and update_stream methods are implemented.

 

How can I solve this issue?

 

Regards,

Omri


Viewing all articles
Browse latest Browse all 2638

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>