how to insert blob data remotely

2004-07-01 Thread Héctor Maldonado
Hi all!..

How can I insert blob data (specifically a jpg image) into a blob field
remotely?.. I mean, the client has to choose a jpg image in his/her PC
and upload it to the server.

I found this piece of code:

INSERT INTO car_models 
(Brand, Picture) 
VALUES
('Subaru Impreza', LOAD_FILE('/somepath/impreza.jpg'));

But LOAD_FILE only works if 'picture.jpg' is placed on the same machine
where the server is running.

Any Idea?

Thanks in Advance

Hector.

-- 
Ing. Hctor Maldonado Melgar 
Dpto. Desarrollo de Software
TCI S.A., Lima-Per
[EMAIL PROTECTED]
Of.: 421-3222
Cel: 9503-9205



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: how to insert blob data remotely

2004-07-01 Thread Peter L. Berghold
On Thu, 2004-07-01 at 11:06, Héctor Maldonado wrote:
 But LOAD_FILE only works if 'picture.jpg' is placed on the same machine
 where the server is running.
 

That makes sense. You could of course NFS mount from the remote machine
to the machine you are working from but that is much the same thing.

Alternatively if you are working in a language like Perl there are other
tricks you can play...

-- 

Peter L. Berghold[EMAIL PROTECTED]
Dog event enthusiast, brewer of Belgian (style) Ales.  Happiness is
having your contented dog at your side and a Belgian Ale in your glass.



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: how to insert blob data remotely

2004-07-01 Thread Victor Pendleton
Is using a programming language such as Java, PHP or VB an option?

-Original Message-
From: Hctor Maldonado
To: [EMAIL PROTECTED]; Omar De la Cruz
Sent: 7/1/04 10:06 AM
Subject: how to insert blob data remotely

Hi all!..

How can I insert blob data (specifically a jpg image) into a blob field
remotely?.. I mean, the client has to choose a jpg image in his/her PC
and upload it to the server.

I found this piece of code:

INSERT INTO car_models 
(Brand, Picture) 
VALUES
('Subaru Impreza', LOAD_FILE('/somepath/impreza.jpg'));

But LOAD_FILE only works if 'picture.jpg' is placed on the same machine
where the server is running.

Any Idea?

Thanks in Advance

Hector.

-- 
Ing. Hctor Maldonado Melgar 
Dpto. Desarrollo de Software
TCI S.A., Lima-Per
[EMAIL PROTECTED]
Of.: 421-3222
Cel: 9503-9205



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: how to insert blob data remotely.. SOLVED :)

2004-07-01 Thread Héctor Maldonado
Hi Again..

Fortunately I found a way to do this using C++/Qt.  Here's the code for
who are interested in:

QFile *myFile;
QSqlQuery query;
QString strQuery;
QByteArray myByteArray;

// open the image and fill the bytearray
myFile = new
QFile(/root/hm/variostepsa/fotos_marcopolo/paradiso1.jpg);
myFile-open(IO_ReadOnly);
myByteArray = myFile-readAll();  
myFile-close();

// Insert the image
strQuery = INSERT INTO Model (Brand, Picture) VALUES ('Subaru', :pic);

query.prepare(strQuery);
query.bindValue(:pic, myByteArray);

if (!query.exec())
qWarning(Eorrr);

I don't know if this is optimal, but it works.. :)


Thanks to all those reply..

Regards, 

Hector.



El jue, 01-07-2004 a las 20:32, Peter L. Berghold escribi:
 On Thu, 2004-07-01 at 11:06, Hctor Maldonado wrote:
  But LOAD_FILE only works if 'picture.jpg' is placed on the same machine
  where the server is running.
  
 
 That makes sense. You could of course NFS mount from the remote machine
 to the machine you are working from but that is much the same thing.
 
 Alternatively if you are working in a language like Perl there are other
 tricks you can play...

-- 
Ing. Hctor Maldonado Melgar 
Dpto. Desarrollo de Software
TCI S.A., Lima-Per
[EMAIL PROTECTED]
Of.: 421-3222
Cel: 9503-9205



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]