TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Lynn Emery
NA
47
56.7k
Upload image to SQL table
Oct 14 2013 10:55 AM
Hi, I wish to upload an image to an sql table.
So far I have used an open file dialogue and a picturebox where the user can browse for images and preview it. The code I have used for this is ;
//open the BtnBrowse dialog
OpenFileDialog BrowseDialogue = new OpenFileDialog();
//Select filters on which file types to upload
BrowseDialogue.Filter = "Images Files (*.jpg; *.jpeg; *.gif; *.bmp; *.png:)|*.jpg; *.jpeg; *.gif; *.bmp; *png;";
if (BrowseDialogue.ShowDialog() == DialogResult.OK)
{
//Preview the image in a picturebox
pictureBox1.Image = new Bitmap(BrowseDialogue.FileName);
//Display image path in textbox
textBox1.Text = BrowseDialogue.FileName;
The above code all works fine but I now want to have an upload button where the image in the picturebox is uploaded to the database, I understand that there are two ways of doing this via file stream or memory stream.
The table name I wish to upload to is contents and the field name is image.
Could someone provide me with some information of how to go about this?
Many thanks for your help.
Reply
Answers (
3
)
printpreviewdialog print preview problem
Bind Combo bOx