UI5 plugin - uploadCollection

简介: UI5 plugin - uploadCollection

Sent: Friday, 15 April, 2016 4:45 PM

Here’ s my steps to use uploadCollection.


Step1: Set URL for this plugin in method “initAttach……”, this method will be called by controller standard method “onInit”.


Step2: When files are changed on UI, call handler method: “onAttachmentChange” to set some parameters for UPloadCollection plugin.

Which are almost the same as your implementation in opportunity attachments.



My Problems:

The request to upload file are always meet “HTTP Type 415 upported media type”.

I didn’t set the “content-type” specially, as you did in the opportunities UI (s3.controller), the uploaded content-type is “image/jpeg”.


By the way, I also check the your opportunities UI, the content-type for submit request is also “image/jpeg”.


URL:

https://hybris-cecenter-agenthome-ui-test-v1.us-east.modules.yaas.io/?client_id=YGJmifyZdXmoJTHOQjRD0CZy67NdQqwj


Reproduce steps:


进入title: Service ticket.

任意选中一个ticket, 进入”attachment” 的标签,上传任意附件,比如jpg图片,或者txt文本。

Sent: Friday, 15 April, 2016 5:54 PM

Subject: 答复: Need technique support for UI5 plugin: uploadCollection

我对比了你们那个opportunities的附件上传功能:

我们的ui version是1.28.3, 你们的是1.28.5


Debug进去插件的框架,在我们那个报错的程序那里,两个版本的逻辑差别还是比较大:


报错的calling stack: FileUploader.upload() àFileUploader.sendFiles()


1.28.3: FileUploader.sendFiles() 从黄色的地方就开始报错了,跳出来了


1.28.5 FileUploader.sendFiles() 从黄色的地方继续向下执行,直到成功上传。 这两个部分的逻辑是不一样的。

但是我应用的controller, 如何设置uploadCollection是几乎和你们的是一样的。

我们现在附件终于可以上传了

我们最终的解决办法还是没有Opportunity一样的发relative path,我看了那个relative path的值,很难理解,感觉像是和后台ABAP系统暴露的某个service的值有关系。

Yaas这里恐怕行不通。

我这里解决问题的思路是:

我以前用自己写的一个HTML + JS 调用后台Service 成功过。用的是JS的FormData, 提交能够成功:说明用Absolute path还是能行,而且用开放的FormData的方式是可以.

正好周五我们这边Service的同事MARK在联调时, 帮我看这个问题时:发现框架里面调的FileUpload.jsàupload时,如果设置:“userMultiplePart”的属性为true, 就可以调用框架方法里面的FormData把文件包装好,上传。上传的数据格式和之前用HTML + js上传文件的格式一样。

否则,默认情况下:“userMultiplePart”的属性为false, 直接把文件作为参数传过去就报415-Unsupported media type的错误。

3. 我的实现方式:

在上传文件以前,取出FileUploader(是每一个item对应的上传插件). 设置property useMultipart 为true.

在开放JS里面,

可以利用这样的代码: FormData forData1= new FormData(); forData1.append(‘file’, uploadeFile); 再调用AJAX 的POST方法,来实现文件上传,正好这里的代码和928后面的逻辑是完全一样的。

808151

相关文章
|
Web App开发 JavaScript 前端开发
SAP UI5 Custom Cordova plugin的调试方法
SAP UI5 Custom Cordova plugin的调试方法
105 0
SAP UI5 Custom Cordova plugin的调试方法
|
5月前
|
前端开发 搜索推荐 开发者
SAP UI5 sap.m.Column 控件的 minScreenWidth 属性介绍
SAP UI5 sap.m.Column 控件的 minScreenWidth 属性介绍
|
5月前
|
JavaScript 前端开发 开发者
SAP UI5 控件 sap.m.ListBase 的 inset 属性的作用介绍
SAP UI5 控件 sap.m.ListBase 的 inset 属性的作用介绍
|
5月前
|
前端开发 JavaScript API
SAP UI5 sap.ui.require.toUrl 的作用介绍
SAP UI5 sap.ui.require.toUrl 的作用介绍
|
5月前
|
JSON 前端开发 测试技术
SAP UI5 sap.ui.core.util.MockServer.simulate 方法介绍
SAP UI5 sap.ui.core.util.MockServer.simulate 方法介绍
使用 SAP UI5 Event Bus 机制,修复 SAP UI5 分页显示数据的一个 bug 试读版
使用 SAP UI5 Event Bus 机制,修复 SAP UI5 分页显示数据的一个 bug 试读版
|
5月前
|
缓存 JavaScript 前端开发
如何理解 SAP UI5 的 sap.ui.define 函数?
如何理解 SAP UI5 的 sap.ui.define 函数?
|
5月前
|
监控 测试技术
SAP 电商云修改 Product Catalog Staged 版本数据后,同步到 online 版本的 UI 操作
SAP 电商云修改 Product Catalog Staged 版本数据后,同步到 online 版本的 UI 操作
什么是 SAP ABAP 里的 Subscreen
什么是 SAP ABAP 里的 Subscreen
什么是 SAP ABAP 里的 Subscreen
|
5月前
|
开发者 UED
关于 SAP UI5 sap.m.Column 的 demandPopin 属性
关于 SAP UI5 sap.m.Column 的 demandPopin 属性
下一篇
无影云桌面