I'm trying to store a screenshot (image) uploaded with the file upload component in perspective into a MSSQL database. The image is retrieved as a byte array, but when I attempt to insert it into the database, I'm encountering speed issues and some errors.
From the file upload component I have an event script on fileUploaded
byte_data = event.file.getBytes()
# old b64 encoding...
self.view.custom.screenshot = byte_data
With this named query
INSERT INTO UserFeedback (userid, FeedbackType, Description, Screenshot)
VALUES (:userid, :FeedbackType, :Description, CONVERT(VARBINARY(MAX), :Screenshot))
the screenshot column is of type varbinary
I got an error
ValueError: byte must be in range(0, 256)
I've also encoded the data in Base64, but that also presented issues (chinese text?). Furthermore, I've been instructed not to store anything in the gateway/server files.
Has anyone faced a similar problem? Any suggestions on how to efficiently store and retrieve images (or large binary data) in a MSSQL database via Ignition without storing on the gateway? Should I look into alternatives like storing the image in the filesystem and keeping only the path in the database?
Any insights or suggestions would be highly appreciated!