Click here to Skip to main content
15,301,414 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am creating my first GUI software, I need to know How to create a function that allows users to upload pictures from their system and insert them into the database.

What I have tried:

def filedialogs(self):
        global get_img
        get_img = filedialog.askopenfilename(filetypes=(("png","*.png"),("jpg","*.jpg"),("Allfile","*.*")))


def convert_image_into_binary(self):
        with open(get_img, 'rb') as file:
        self.photo_image=file.read()
        return photo_image
Posted
Comments
Richard MacCutchan 15-Dec-21 3:37am
   
Is this supposed to be a Web application or just a stand-alone Windows one?
asaad kittaneh 15-Dec-21 17:50pm
   
Richard, it's a stand-alone Windows, thank you for your response I solve it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900