通过rtmps+java上传服务器上的文件 [英] Upload file on server through rtmps+java

查看:28
本文介绍了通过rtmps+java上传服务器上的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要通过 flex GUI 在服务器上上传文件,使用 rtmps 协议在服务器上发送文件.

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

我试图在服务器上只发送 FileReference 并且请求已经执行,但在服务器端我只有空的 ObjectMap.我知道我可以使用 URLRequest,但我需要确切的 rtmps 请求.

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.

我的 Flex 代码:

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);
}

我的 Java 代码:

My Java code:

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

有人可以帮我吗?

推荐答案

Java 不知道如何将 FileReference 类映射到 Java 等效项.在 flex 中,从 FileReference 获取 ByteArray 并将其发送到服务器.Java 知道如何处理字节数组.你可以在服务器上随意使用它.

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.

这篇关于通过rtmps+java上传服务器上的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆