文件上传不适用于localhost中的Openfire和Smack。我可以在本地主机上连接并登录,但是尝试使用HttpFileUploadManager上传文件时出现以下错误:
failed to connect to 192.168.0.14 (port 7443): connect failed: ETIMEDOUT (Connection timed out)
简短的Android代码:
HttpFileUploadManager httpFileUploadManager = HttpFileUploadManager.getInstanceFor(MainActivity.this.connection);
File file = new File("/storage/3566-3936/DCIM/test.jpg");
URL url = httpFileUploadManager.uploadFile(file, new UploadProgressListener() {
@Override
public void onUploadProgress(long uploadedBytes, long totalBytes) {
Log.d("Progress:",uploadedBytes+"");
}
});
HTTP文件上传插件也已添加到openfire服务器