问题
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