and save user sent photo and names it by chat_id.
👇🏻👇🏻👇🏻👇🏻👇🏻
user_photo = update.message.photo[-1].get_file()
user_photo.download(f'''{update.message.chat_id} - front.jpg''')
👆🏼👆🏼👆🏼👆🏼👆🏼
the problem is that i need the photo to be saved in:
project folder/another folder
but it automatically saves in project folder
how can i change the directory?!
tnx
Hi, which library are you using? I assume that you need to pass the download location to the download() method. So I guess this would work: user_photo.download(f'''/path/to/directory/{update.message.chat_id} - front.jpg''')
user_photo.download(f'''another-directory/{update.message.chat_id} - front.jpg''')
No such file or directory: 'another_folder/226541220 - front.jpg'
Обсуждают сегодня