How to transfer media files using Worklight

回眸只為那壹抹淺笑 提交于 2019-12-12 13:16:42

问题


What's the correct way of transferring media (photos or movies) using Worklight Adapters?

I sent a photo via the adapter and got the error: form too large, exceed the maximum size... I read I need to change the form size through the Jetty

but the server I'll deploy the app won't be a jetty so what shell i do?
Thanks!


回答1:


Please see topic Uploading large (and binary) files to Worklight adapter.

Basically, Worklight does not have the equivalent to an HTTP POST mechanism that allows you to transfer arbitrarily large chunked data. For large files of unknown sizes (photos, video, audio) you'll need to upload the file to the server outside the Worklight adapter framework. For example you could simply post it to a web server you have configured. In my case (in the above referenced answer) I needed to create an entire client-server mechanism to negotiate a port and key, start listening on that port, then accept requests and ensure the posting client passes the key as authorization to transfer the secure data.

Hopefully IBM will provide a formal service for this in a future release.




回答2:


Adapters do not work with html forms, they work with data. You will need to convert your image to base64 and submit as a adapter invocation parameter.

Having more information regarding what exactly you're trying to achieve might be helpful.



来源:https://stackoverflow.com/questions/15460588/how-to-transfer-media-files-using-worklight

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!