问题描述
我想在桌面浏览器的情况下通过worklight适配器上传图片,对于IOS,Android设备也可以,请你建议我们如何通过适配器发布图片。我找到一些示例将图像作为base 64对象发布。
I want to upload image through worklight adapter in case of desktop browser and for IOS, android devices also, could you please suggest how we can post image through adapter. I find some example to post image as base 64 object.
请提供任何参考,我们可以将图像作为多部分表单数据上传。
Please provide me any reference by which we can upload image as multipart form data.
推荐答案
在Worklight中使用JavaScript适配器无法做到这一点。你也许可以使用Cordova或AJAX来做这件事,但我很确定你也应该在那里使用base64编码。
You cannot do this using JavaScript adapters in Worklight. You could perhaps do this using Cordova or AJAX, but I'm pretty sure you should use base64 encoding there as well.
你发送二进制文件的另一种可能性是通过使用Java适配器。
Java适配器是从MobileFirst Platform(以前称为Worklight)7.0开始引入的。
The only other possibility for you to send binary is by using Java adapters.
Java adapters were introduced starting MobileFirst Platform (previously "Worklight") 7.0.
您可以了解Java适配器(基本上一个JAX-RS应用程序),这里:
You can learn about Java adapters (basically a JAX-RS application), here: https://developer.ibm.com/mobilefirstplatform/documentation/getting-started-7-0/server-side-development/adapter-framework-overview/
这篇关于通过没有base64编码的Worklight服务器发送图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!