Upload file on server through rtmps+java

守給你的承諾、 提交于 2020-01-06 20:02:16

问题


I need to upload file on server through flex GUI which send file on server with using rtmps protocol.

I tried to send on server just FileReference and request has performed, but on server side i got only empty ObjectMap. I know that I can user URLRequest, but I need exactly rtmps request.

My Flex code:

public function uploadFile(file:FileReference):void{
     NetConnection nc = new NetConnection();
     nc.client = this;
     nc.proxyType = "best"; 
     nc.connect(connectionURL, "3.0", "userName", "password");
     nc.call("uploadFile", null, file);
}

My Java code:

public void uploadFile(Object param) { // <-- param is empty ObjectMap
    log.info("Upload file.");
    // save file on server
}

Can anyone help me?


回答1:


Java doesn't know how to map the FileReference class to a java equivalent. In flex, get the ByteArray from the FileReference and send that to the server. Java knows how to deal with a byte array. You can do with it on the server as you please then.



来源:https://stackoverflow.com/questions/23108556/upload-file-on-server-through-rtmpsjava

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