I am developing a chat application using XMPPOpenfire 4.1.4, one-on-one text chat is working fine, but for now I get an image retrieval error
Here is my code to send the file:
Log.e("ad",">selectedImagePath====="+selectedImagePath);
FileTransferManager manager = FileTransferManager.getInstanceFor(Config.conn1);
OutgoingFileTransfer transfer;
transfer = manager.createOutgoingFileTransfer(userJid+"/"+Config.conn1);
File file = new File(selectedImagePath);
try {
transfer.sendFile(file, "image message test");
} catch (Exception e) {
e.printStackTrace();
}
while (!transfer.isDone()) {
if (transfer.getStatus().equals(AMPExtension.Status.error)) {
Log.e("ad","ERROR!!! " + transfer.getError());
} else if (transfer.getStatus().equals(FileTransfer.Status.cancelled)
|| transfer.getStatus().equals(FileTransfer.Status.refused)) {
Log.e("ad","Cancelled!!! " + transfer.getError());
}
try {
Thread.sleep(1000L);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
if (transfer.getStatus().equals(FileTransfer.Status.refused) ) {
Log.e("ad","refused cancelled error" + transfer.getError());
}
else if (transfer.getStatus().equals(FileTransfer.Status.error))
{
Log.e("ad","error="+ transfer.getError());
}
else if (transfer.getStatus().equals(FileTransfer.Status.cancelled))
{
Log.e("ad","cancelled");
}
else {
Log.e("ad","Success");
}
Here is my journal:
02-23 14:56:32.489 14951-14951/com.app.chatv1 E/ad: >selectedImagePath=====/storage/emulated/0/Pictures/1519194363122.jpg
02-23 14:56:33.490 14951-14951/com.app.chatv1 E/ad: error=null
I have another related question: when I successfully sent the image to the server, where will it be placed on the server?
source
share