Page 1 of 1
Someone saved a pdf file into a mysql blob field
Posted: Sat May 04, 2013 2:16 am
by martingz
I need to save a pdf file to a mysql blob field, the file could be anywhere, hard disk, CD, network, etc.
what I can do with pictures, but now they occurred it was better a PDF
thanks for your attention
Re: Someone saved a pdf file into a mysql blob field
Posted: Sat May 04, 2013 2:49 am
by Rathinagiri
Re: Someone saved a pdf file into a mysql blob field
Posted: Sat May 04, 2013 3:28 am
by martingz
Yes rathi but my blob field is empty, with images works fine
tnx
Re: Someone saved a pdf file into a mysql blob field
Posted: Sat May 04, 2013 8:55 am
by Rathinagiri
Had you tried load_file() mysql function?
Re: Someone saved a pdf file into a mysql blob field
Posted: Sat May 04, 2013 9:16 am
by Rathinagiri
When I ran the following queries it worked.
For saving pdf file into blob col
Code: Select all
insert into test1 ( pdf_col ) values ( load_file( 'd:/sample.pdf' ) )
For saving pdf file from blob col
Code: Select all
select pdf_col from test1 INTO DUMPFILE 'd:/samplecopy.pdf'
Re: Someone saved a pdf file into a mysql blob field
Posted: Sat May 04, 2013 6:56 pm
by martingz
I've seen it, but the client does not have access to the server and to use the load_file must be the file on the server
continue to seek a solution
in php you add "/" to load a pdf file
regrads
Re: Someone saved a pdf file into a mysql blob field
Posted: Mon May 06, 2013 6:20 pm
by martingz
My partner find the solution for save a pdf into blob field
my partner found the solution to save a pdf on a blob field
you just have to base64 encode and save pdf
cbuff:=hb_base64encode(cbuff)
and to write the pdf
hb_base64decode(oRow:fieldGet("contenido"))
I hope this is useful
Regrads
Re: Someone saved a pdf file into a mysql blob field
Posted: Mon May 06, 2013 6:57 pm
by Rathinagiri
Thanks a lot for that.