Hello Experts,
I have written the code for uploading for file which is working very fine from Gateway client and also from eclipse IDE
I am using WebIDE and using the same code for sending the slug but its not coming in create stream method.
Please help me to resolve the issue.
The code I have written is below:
onUploadAction: function(oEvent){ var file = oEvent.oSource.oFileUpload.files[0]; try { if (file) { var a = "/sap/opu/odata/SAP/ZGR_GREYTIPNEW_SRV/CreateEMPPhotoSet" var f = { headers : { "X-Requested-With" : "XMLHttpRequest", "Content-Type" : "application/atom+xml", DataServiceVersion : "2.0", "X-CSRF-Token" : "Fetch" }, requestUri : a, method : "GET" }; var oHeaders; OData.request(f, function(data, oSuccess,oFailure) { var oToken = oSuccess.headers['x-csrf-token']; oHeaders = { "x-csrf-token" : oToken, "slug" : "1311@" + file.name }; var oURL = "/sap/opu/odata/SAP/ZGR_GREYTIPNEW_SRV/CreateEMPPhotoSet"; //evfileuploadset"; jQuery.ajax({ type: 'POST', url: oURL, headers: oHeaders, cache: false, contentType: file.type, processData: false, data: file, success: function(data){ sap.m.MessageToast.show("File Uploaded Successfully"); }, error:function(data){ sap.m.MessageToast.show("File Uploaded not Successfully"); } }); }); } } catch(oException) { jQuery.sap.log.error("File upload failed:\n" + oException.message); } }