How to save the uploaded image to database in perspective?

I am using a file upload component in perspective to upload multiple images and I want to save those uploaded images to my database. How can I do that that?

Thank You

I would,

configure an onFileReceived event script and invoke event.file.getBytes() and send to DB as blob

3 Likes

It worked, thank you and now I am trying to retrieve the saved image from database and show it in image component in perspective. I tried different ways but none of them seems working.

1 Like

I am new in ignition, I don’t know how to achieve that using webdev, if you could help me with that then it will be really helpful.

Thank you.

What kind of DB are you using?

MySQL

If they’re small. You would query them out as base 64. with TO_BASE64(col)

In Jordan’s post, it goes over that. :point_up_2:

You could also store them straight to the directory. Something like

	upload_path = 'webserver/webapps/main/'
	event.file.copyTo(upload_path + event.file.name)
1 Like