注册

webIm在H5手机端上传拍照文件

webim上传文件或者图片,给的接口是使用控件获取并上传文件的。
现在用H5+做手机app,原生调用手机摄像头或者图库,获取的只是文件路径。而不是input控件生成的fileupload对象。
因此没办法用var file = WebIM.utils.getFileUrl(input的id)工具获取文件对象。
msg.set({
apiUrl: WebIM.config.apiURL,
file: file, //msg: info.content,
to: info.to,
roomType:false,
onFileUploadError: function onFileUploadError(error) {
console.log(error);
},
onFileUploadComplete: function onFileUploadComplete(data) {
url = data.uri + '/' + data.entities[0].uuid;
console.log("上传成功"+JSON.stringify(data));
//me.refs.picture.value = null;
},
success: function(id,serverMsgId){
//bindMsgList(info);
console.log("发送成功"+id+"/"+serverMsgId);
var chat = plus.webview.getWebviewById(info.to);
var msg = {sender:'self',type:info.type,content:info.content};
mui.fire(chat,'bindlist',msg);

},//消息发送成功回调
fail: function(message){
console.log(JSON.stringify(message));
},
flashUpload: WebIM.flashUpload
});
conn.send(msg.body);
这一段虽然会提示上传成功,但其实是0字节的文件。
这里我应该怎么做呢?
是自己架设个服务器端,通过ajax上传文件,然后发送链接地址给对方?还是有其他解决方法?

比方说混合开发,用android或者ios的sdk来上传?

请帮忙解答。能有具体的方法代码最好了。
已邀请:
看下这个链接文档:http://docs.easemob.com/im/100serverintegration/40fileoperation
请问楼主现在解决了这个问题吗?

要回复问题请先登录注册