inserting image in mysql database

Asked

Viewed 790 times

0

If I want to insert an image in the database just use the following query:

INSERT INTO teste (Id_Blob,Na_Imagem) VALUES (1,LOAD_FILE("C://imagem.png"));

if I want to insert an image that be on another computer on the network, how does it vary? I am trying to use the following code.

INSERT INTO teste (Id_Blob,Na_Imagem) VALUES (1,LOAD_FILE("///10.1.1.10//Fotos//2.png"));

But the field of the image longblob empty.

1 answer

0


I solved my problem with a POG (kkkk) is not the best way, but solved it. I used the **File.Copy()**, I copied the file from the virtual machine to the location (where the application is running). I created a variable to store the saved file path on the local machine. and used the command: INSERT INTO teste (Id_Blob,Na_Imagem) VALUES (1,LOAD_FILE("VariavelCaminho"));

If anyone has another solution please share That link "Save Image in Mysql" teaches to do this, but particularly could not do, because I work with classes, and I have a class for connection with the bank. That’s it. #POG on the head

Browser other questions tagged

You are not signed in. Login or sign up in order to post.