C# and MySQL - Storing a picture file into database

Hi guys 'n gals,

How would I go about saving a JPG picture into a MySQL Database, with C#? I know how to connect to the database, but I have no idea what I would go about converting the picture into data, which I can store into the database, let alone, reading it back out.


Any ideas?

Cheers!
LVL 4
Cyber-DrugsAsked:
Who is Participating?
 
f_o_o_k_yCommented:
This might be helpful.
Its used with asp page and MSDE but it should be very similar
instead image data type in MYSQL use BLOB.
http://www.aspfree.com/c/a/ASP.NET/Uploading-Images-to-a-Database--C---Part-I/
http://www.aspfree.com/c/a/ASP.NET/Retrieving-Images-from-a-Database--C---Part-II/

Best Regards
FooKy
0
 
emrahtufanCommented:
I dont know the exact needs of the application but I think, instead of inserting an image to the database, upploading it to the some server location and saving the path in the database is better.

Regards

emrah

0
 
zajda82Commented:
here you have an example of storing images in MySql

http://www.codeproject.com/aspnet/image_asp.asp

0
 
Cyber-DrugsAuthor Commented:
Thanks f_o_o_k_y and zajda82,

After a bit of tweaking, that did the trick!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.