Someone saved a pdf file into a mysql blob field

Moderator: Rathinagiri

Post Reply
martingz
Posts: 342
Joined: Wed Nov 18, 2009 11:14 pm
Location: Mexico
Has thanked: 61 times
Been thanked: 36 times

Someone saved a pdf file into a mysql blob field

Post 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

User avatar
Rathinagiri
Posts: 5411
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 252 times
Been thanked: 304 times
Contact:

Post by Rathinagiri »

East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

martingz
Posts: 342
Joined: Wed Nov 18, 2009 11:14 pm
Location: Mexico
Has thanked: 61 times
Been thanked: 36 times

Post by martingz »

Yes rathi but my blob field is empty, with images works fine

tnx

User avatar
Rathinagiri
Posts: 5411
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 252 times
Been thanked: 304 times
Contact:

Post by Rathinagiri »

Had you tried load_file() mysql function?
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

User avatar
Rathinagiri
Posts: 5411
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 252 times
Been thanked: 304 times
Contact:

Post 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'
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

martingz
Posts: 342
Joined: Wed Nov 18, 2009 11:14 pm
Location: Mexico
Has thanked: 61 times
Been thanked: 36 times

Post 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

martingz
Posts: 342
Joined: Wed Nov 18, 2009 11:14 pm
Location: Mexico
Has thanked: 61 times
Been thanked: 36 times

Post 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

User avatar
Rathinagiri
Posts: 5411
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 252 times
Been thanked: 304 times
Contact:

Post by Rathinagiri »

Thanks a lot for that.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

Post Reply