Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 417
  • Last Modified:

Upload Image to MySQL

hi, how would I go about Uploading an Image to MySQL?
0
SaLz
Asked:
SaLz
  • 3
2 Solutions
 
Ivanov_GCommented:
how do you connect to mySQL database? BDE, ADO, dbExpress, Direct Access Components ?
0
 
Ivanov_GCommented:
if you are using ADO, and respectively TADOQuery or TADOImage, specify Field for the image and set its type to ftBlob. Then you have LoadFromFile and SaveToFile methods...
0
 
SaLzAuthor Commented:
DAC
0
 
Ivanov_GCommented:
Which DAC?

ZeosLib
http://www.zeoslib.net/

MySQL DAC
http://www.crlab.com/mydac

Or something else? Please clarify...
0
 
Mohammed NasmanSoftware DeveloperCommented:
Hello
If you work with Table components use:

// to save to db
TBLOBField(MyTable.FieldByName('MyImg')).LoadFromFile(MyFileName);
//load from db
TBLOBField(MyTable.FieldByName('MyImg')).SaveToFile(MyFileName);

if you working with Query then use parameters to assign the value of the field

MyQuery.sql.text := ' insert ........ :MyImg);
// to save to db
MyQuery.ParamByName('MyImg').LoadFromFile(MyFileName);
//load from db
MyQuery.ParamByName('MyImg').SaveToFile(MyFileName);

Regards,
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now