If $filedata is a file on your filesystem -> 'c:\\images\\it em_1.jpg' then
there appears to be no need to do anything. MySQL will load the data as-is.
If you 'read' $filedata into a variable first via fopen,fread,fcl ose then it
seems that you must either base64 or addslashes it before MySQL will except
it. In this case:
$data = '';
$fp = fopen($filedata ,'r');
while (!feof($fp))
{
$data .= fread($fp,1024) ;
}
fclose($fp);
$slashed_data = addslashes($dat a);
UPDATE table_name SET filesize = $filesize, data = '$slashed_data' WHERE id
= 1
---
notice no LOAD_FILE, and quotes around the variable...
Norman
--
Avatar hosting at
www.easyavatar.com
"Frank Natoli" <fr*********@wo rldnet.att.net. nospam> wrote in message
news:KV******** *********@newsr ead2.news.atl.e arthlink.net...
Thanks. Will this work if the data in $filedata is binary? Or must I
base64 the data first?
"Norman Peelman" <np******@cfl.r r.com> wrote in message
news:AN******** ***********@tor nado.tampabay.r r.com...
"Frank Natoli" <fr****@nospam. com> wrote in message
news:eR******** *********@newsr ead3.news.atl.e arthlink.net... Having created a table with a longblob column, what is the insert syntax
to set the value of the longblob column? The data will be read from a file.
example:
UPDATE table_name SET filesize = $filesize, data = LOAD_FILE('$fil edata')
WHERE id = 1
where $filedata is equal to 'drive:/path/to/your/file'
Norman
--
Avatar hosting at www.easyavatar.com