td icon indicating copy to clipboard operation
td copied to clipboard

Naming a file when uploading it

Open Skjolberg opened this issue 5 months ago • 1 comments

I use Python. TdLib does not offer the possibility of setting the name of the file you are going to upload, right? I have looked at ‘https://core.telegram.org/tdlib/docs/classes.html’ and I do not see any possibility of setting the name of the file during upload either.

I have tried the following:

  • Symbolic file, it actually takes the name of the real file, not the symbolic file, it does not work.
  • Renaming the file before uploading it and then setting the original name after uploading it. This is not an option because if my service stops unexpectedly for any reason, when I restart the service, it will not find the file and will end with an error like the following, preventing the upload: [ 1][t 4][175392469.40956495] [FileManager.hpp:211][#1][!GetMessageThreadHistoryRequest] Can't resend local file [full local location of Document] at ‘/mnt/disk1/file.ext’ of size (x) owned by chat (x)
  • Creating a copy of the file with the desired name and uploading it is not feasible because if I handle large amounts of data, I make unnecessary writes to the disk.

That said... Is there no other option? Thanks so much.

Skjolberg avatar Jul 30 '25 20:07 Skjolberg

Yes, no of the official apps allow changing name of the uploaded file.

You can't send the file under a different name without making a copy of the file, or making a hard link to the file.

levlam avatar Aug 01 '25 11:08 levlam