Remote image file to sqlite blob in PHP? -
I have an image file on a remote server. I only have HTTP access to the server, so I use file_get_contents (URL) I'm getting my content.
I need to store this content in the area of type 'Blob' in the Local Skelete 3 database. I am using the PDO object to connect to the database, And I
$ db-> Exec ("myTableBlob" values (".file_get_contents ($ $ IN filepath)." ') ")
To add data to the database
This is not working Apologies If I'm not really making any mistake we all have to learn some way ...
I will not implicate in the causes, this image for me There is no possibility of storing locally and keeping the database in the database. Can be stored in a blob.
You have no control in an SQL. The statement is a very bad idea, for example, image data may contain a quotation mark which will eliminate the string or backslash, which will be interpreted as the control character.
I recommend that you use a prepared statement instead:
$ query = $ db- & gt; Prepare (include "Meritable (Mimegabalob) value (?)"); $ Query-> Binnamum (1, FOPAN ($ pathpost, "RB"), PDO :: Param_Lob); $ Query-> Executed ();
Note that the PDO :: ParamA_LOB is passed to the absolute () you insert the data of the Blob with one stream. This is the reason I am using fopen () instead of file_get_contents ()
Comments
Post a Comment