|
Posted by Andy Hassall on 07/24/05 16:08
On Sat, 23 Jul 2005 18:35:22 GMT, Marcus <JumpMan222@aol.com> wrote:
>Quick question... I am storing jpegs as blobs in a mysql table, which is
>fine on my live server because I am just uploading them using phpmyadmin
>(I am working with a small number of images that will rarely change and
>thus do not have a need for an upload script). My problem is I do all
>my testing on my local host where I do not have phpmyadmin, I do
>everything with mysql through the command prompt. How can I insert rows
>of binary data (jpegs) into my table through the command prompt? Thanks
>very much in advance.
Look in the MySQL manual under "String functions":
"
LOAD_FILE(file_name)
Reads the file and returns the file contents as a string. The file must be
located on the server, you must specify the full pathname to the file, and you
must have the FILE privilege. The file must be readable by all and be smaller
than max_allowed_packet bytes.
If the file doesn't exist or cannot be read because one of the preceding
conditions is not satisfied, the function returns NULL.
mysql> UPDATE tbl_name
SET blob_column=LOAD_FILE('/tmp/picture')
WHERE id=1;
"
--
Andy Hassall / <andy@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Navigation:
[Reply to this message]
|