Closed RuchiraTharaka closed 8 months ago
there is no id or unique id for the remote filed in the File object receives with updateFile update. why is that?
This is exactly as documented in the description of the method: "The file will not have a persistent remote identifier until it is sent in a message".
The file must be sent in a message to become persistent and for the upload to be completed.
Yes, that's true and to be it more clear, this works.
File pdfFile = new File("Telegram1.jpg"); TdApi.InputFile inputFile = new TdApi.InputFileLocal(pdfFile.getAbsolutePath()); TdApi.InputMessageDocument messageDocument = new TdApi.InputMessageDocument(inputFile, null, true, null); client.send(new TdApi.SendMessage(recepient, 0, null, null, null, messageDocument), new SendPdfResultHandler(), null);
Yes, this is expected behavior.
cancelPreliminaryUploadFile
cancels upload of a file with preliminaryUploadFile
that isn't sent in a message.
deleteFile
removes downloaded file from TDLib cache.
deleteMessages
deletes any message, including yet unsent messages. Upload of file is canceled when corresponding message is deleted.
I'm trying to upload a file using PreliminaryUploadFile to send. As the documentary says, UpdateFile updates should say when the uploading is completed. I monitor all the updateFile updates. It works until uploadedSize becomes equal to the file size and even isUploadingActive becomes false after that. But isUploadingCompleted is not becoming true and so, there is no id or unique id for the remote filed in the File object receives with updateFile update. why is that?
This is how i upload the file; File pdfFile = new File("Telegram1.pdf"); client.send(new TdApi.PreliminaryUploadFile(new TdApi.InputFileLocal(pdfFile.getAbsolutePath()), new TdApi.FileTypeDocument(),1), new UploadFileResultHandler(client), null);
This is the UpdateHandler; private static class UpdateHandler implements Client.ResultHandler { @Override public void onResult(TdApi.Object object) { if(object instanceof TdApi.UpdateFile){ System.out.println(object); }
} }