Skip to Content
Dec 13, 2015 at 02:30 PM

FileUploader - 405 Method Not Allowed


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:

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) {  
          "Return Code: " + sResponse, "Response", "Response");  

// create a button to trigger the upload  
var oTriggerButton = new sap.ui.commons.Button({  
        press:function() {  
        // call the upload method  
        oFileUploader.insertHeaderParameter(new sap.ui.unified.FileUploaderParameter({name: "slug", value: oFileUploader.getValue() }));

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?