Store images in a database

Hello!

I’m using the following script:

filename = system.file.openFile() # Ask the user to open a file if filename != None: filedata = system.file.readFileAsBytes(filename) system.db.runPrepUpdate("INSERT INTO Files (file_data) VALUES (?)", [filedata])

And when I select a file and store it in a database (the column name is blob and the datatype is blob) i recieve this error mesage:


Why is this happening? how could I solve that?

Thank for your answers