Source language: Translate to:

how save image file in mysql blob field?

Questions about our Advanced Database plug-in

Moderator: Neosoft Support

how save image file in mysql blob field?

Postby oblivision » Fri May 30, 2008 5:41 pm

I tryed this
FileToVar "[PubDir]test.jpg" "[temp_filetoupload]"

SetVar "[[db_name].tbl_test.file_blob]" "[temp_filetoupload]"

but seem that file to var is not efficient with jpeg format file.
in the trace I see var "[temp_filetoupload]" = at first 4 carachter of selected file.

I tried to read a file in with:
FileRead "[PubDir]test.jpg" "All" "[temp_filetoupload]"
setVar "[temp_filetoupload]" "[PubDir]ftp\test.jpg"


How I can do it?
oblivision
 
Posts: 5
Joined: Sun Oct 07, 2007 12:06 pm

Postby Gaev » Fri May 30, 2008 6:48 pm

oblivision:

The FileRead, FileWrite and FileToVar commands ONLY work with Text files.

There is a whole section in the NeoBookDBPro Help file called "Picture Field Considerations" that explains how to load image (and other binary) files into BLOB fields of a database ... in short ...
Code: Select all
SetVar "[MyDB.Clients.Photo]" "!c:\somePath\abc.jpg"
or
SetVar "[MyDB.myTable.myBLOB]" "[FileName]"
User avatar
Gaev
 
Posts: 3718
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby dpayer » Sat May 31, 2008 7:21 am

Gaev wrote:oblivision:

The FileRead, FileWrite and FileToVar commands ONLY work with Text files.


It is also possible to mime encode the file and save THAT as a blob. This turns the binary data into text.

David P>
User avatar
dpayer
 
Posts: 1380
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

blob upload

Postby oblivision » Sat May 31, 2008 10:35 am

I tried it but in mysql the blob results is the path of file
oblivision
 
Posts: 5
Joined: Sun Oct 07, 2007 12:06 pm

Postby Gaev » Sat May 31, 2008 12:36 pm

oblivision:
... but in mysql the blob results is the path of file
It would be less confusing all around if you were more specific about what you mean by "mysql blob results".

If you mean that after doing ...
Code: Select all
SetVar "[MyDB.myTable.myBLOB]" ""!c:\somePath\abc.jpg"
... the variable contains the "c:\somePath\abc.jpg" ... that is fine ... after you have closed your table ... you can check the contents of the BLOB field by re-opening the table, doing dbpExportBlob and then loading the exported file into a Picture object (with SetObjectFileName).

If you mean something else ... please explain ... perhaps using copies of actual commands used to create the table and to load the image files.
User avatar
Gaev
 
Posts: 3718
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

are you sure?

Postby oblivision » Mon Jun 02, 2008 3:20 pm

I do it. I do it before post in the forum. exported file contains only path. maybe I must define a blob field in neobook.
I use mysql. I fail when import a file in blob fields of my db.
I used neobook's embedded and worked fine. are you sure about import blob? I try again now. please post me other reply.
oblivision
 
Posts: 5
Joined: Sun Oct 07, 2007 12:06 pm

Postby Gaev » Mon Jun 02, 2008 4:01 pm

oblivision:
I do it. I do it before post in the forum. exported file contains only path.
... and I responded that ...
The FileRead, FileWrite and FileToVar commands ONLY work with Text files.

... so, as I said before ...
If you mean something else ... please explain ... perhaps using copies of actual commands used to create the table and to load the image files.

maybe I must define a blob field in neobook.
I use mysql. I fail when import a file in blob fields of my db.
That is something you can try out all by yourself ... but this very point emphasizes the need to see the actual commands you are using to create the table and load the image files ... so there is no time wasted "guessing about the nature of the problem"
User avatar
Gaev
 
Posts: 3718
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby oblivision » Mon Jun 02, 2008 4:53 pm

i used SetVar "[MyDB.Clients.Photo]" "!c:\somePath\abc.jpg"
oblivision
 
Posts: 5
Joined: Sun Oct 07, 2007 12:06 pm

Postby oblivision » Mon Jun 02, 2008 4:54 pm

and blob export make a file that contain a text of path
oblivision
 
Posts: 5
Joined: Sun Oct 07, 2007 12:06 pm


Return to NeoBookDBPro

Who is online

Users browsing this forum: No registered users and 2 guests