How to save an image to database using SQLite and PHP?
I want to save an image to the database using SQLite. I send开发者_如何学编程 the image via <input type='file'>
in HTML, get the file in the $_FILES
var in PHP, and after this, what I should do?
I created a BLOB
field in the database. Currently I'm using SQLite 2.1, because that is the limitation of my homework.
Should I convert an image to binary to store in a database or do something else?
you can do $image = file_get_contents( $_FILES['file']['tmp_name'] );
And then upload it into your blob column (of course it needs to be escaped before, PDO)
精彩评论