点击此处---> 群内免费提供SAP练习系统(在群公告中)
加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)
大家好,
在我的项目中,我使用了uploadcollections,我可以从本地系统中选择文件,但是当我单击"立即上传"按钮时,浏览器控制台中会显示以下错误。
/*查看从这里开始*//*页面控制器从这里开始*/ sap.ui.define([ 'jquery.sap.global', 'sap/m/MessageToast', 'sap/m/UploadCollectionParameter', 'sap/ui/core/mvc/Controller' ],函数(jQuery,MessageToast,UploadCollectionParameter,Controller){ "使用严格"; var PageController = Controller.extend(" UploadCollections.controller.View1",{ onChange:function(oEvent){ var oUploadCollection = oEvent.getSource(); //标头令牌 var oCustomerHeaderToken = new UploadCollectionParameter({ 名称:" x-csrf-token", 值:" securityTokenFromModel" }); oUploadCollection.addHeaderParameter(oCustomerHeaderToken); MessageToast.show("已触发事件更改"); }, onFileDeleted:function(oEvent){ MessageToast.show("事件文件已删除触发"); }, onFilenameLengthExceed:function(oEvent){ MessageToast.show("事件filenameLengthExceed已触发"); }, onFileSizeExceed:function(oEvent){ MessageToast.show("事件文件大小已触发"); }, onTypeMissmatch:function(oEvent){ MessageToast.show("事件类型未匹配触发"); }, onStartUpload:function(oEvent){ var oUploadCollection = this.getView()。byId(" UploadCollection"); /* var oUploadCollection = this.getView()。byId(" UploadCollection")。setUploadUrl("/img/SAP/PUBLIC/MOBO/HCP/CC"); */ var oTextArea = this.getView()。byId(" TextArea"); var cFiles = oUploadCollection.getItems()。length; var uploadInfo =""; oUploadCollection.setUploadUrl("/img/SAP/PUBLIC/MOBO/HCP/CC"); oUploadCollection.upload(); uploadInfo = cFiles +"文件"; 如果(oTextArea.getValue()。length === 0){ uploadInfo = uploadInfo +"不带注释"; }其他{ uploadInfo = uploadInfo +"带注释"; } MessageToast.show("方法上传称为(" + uploadInfo +")")); sap.m.MessageBox.information(" Uploaded" + uploadInfo); oTextArea.setValue(""); }, onBeforeUploadStarts:function(oEvent){ //标头 var oCustomerHeaderSlug = new sap.m.UploadCollectionParameter({ 名称:"子弹", 值:oEvent.getParameter(" fileName") }); oEvent.getParameters()。addHeaderParameter(oCustomerHeaderSlug); setTimeout(function(){ MessageToast.show(" EventUploadStarts触发事件"); },4000); }, onUploadComplete:function(oEvent){ var sUploadedFileName = oEvent.getParameter(" files")[0] .fileName; setTimeout(function(){ var oUploadCollection = this.getView()。byId(" UploadCollection"); for(var i = 0; i <内容> <标签 text =" Layout:"> <选择 id =" tbSelect" selectedKey ="全部" change =" onSelectChange"> 选择> <按钮 id =" Button" text ="立即上传" 按=" onStartUpload"> 按钮> (81.7 kB)
您无法将文件上传到本地主机。 您需要具有Netweaver Gateway这样的后端系统才能接收文件,然后可以从WEB IDE使用FileUploader/FileUploadCollection上传文件,然后使用OData Services将其发送到后端。
您好,
在XML视图中添加属性uploadUrl ="/img/SAP/PUBLIC/MOBO/HCP/CC"。
它是一个静态属性。
此致
Gururaj
一周热门 更多>