I tried this and it DOES work with my PDFs.  However, I didn't fully
understand how LOAD_FILE would handle all different kinds of binary data, so
I tried the same thing with a JPG.  It ended up dropping over half of the
data.  So although LOAD_FILE does work for my PDFs, how can I go about
getting any form of data into a BLOB?  I suspect it has something to do with
converting the data to hex, but can't find a MySQL function to do that (that
is, to take a file and convert it... not just a string of characters).

Thanks,

Lou

----- Original Message ----- 
From: "Sasha Pachev" <[EMAIL PROTECTED]>
To: "Lou Olsten" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, May 11, 2004 5:01 PM
Subject: Re: Saving PDF's as Blobs


> Lou Olsten wrote:
> > What SQL statement can I use to insert a PDF into a BLOB column?  I
don't want a pointer to the file, I want the actual file stored as a BLOB.
>
> If the file is on the server already -
>
> insert into pdfs (content) values(load_file('/path/to/file.pdf'))
>
> If the file is on the client, use some client language (C,Perl,PHP), call
> mysql_real_escape_string() on the contents of the file and insert the
escaped
> string.
>
>
>
> -- 
> Sasha Pachev
> Create online surveys at http://www.surveyz.com/
>
> -- 
> 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]

Reply via email to