Click here to Skip to main content
15,901,205 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello !!!

I have a situation where i have to save a image that is in a folder into database on button click.
I am working on an gate pass application. I have saved image that is being clicked by webcam into a folder but i am stuck at how to save this into databse on button click.

please guide me what should i do !!I don't want to insert path of this image into database but the image itself whan button Save is clicked.
Posted
Updated 29-Aug-12 19:02pm
v2

You have saved the image in your local folder.
now insert the path of the image where it is saved into the database.
 
Share this answer
 
Comments
ujjwal uniyal 30-Aug-12 1:15am    
I don;t want to save the path of the file in database but the file itself. i'll delete the file from the folder after saving it in the database
Hi,

I found an article in code project. it will work for you,

Please check Storing and Retrieving Images from SQL Server using Microsoft .NET[^]

Although you have not specified your database but here in above article it's MSSQL

Thanks
-Amit Gajjar
 
Share this answer
 
Comments
ujjwal uniyal 30-Aug-12 1:34am    
I know how to save and retrieve image from sql server. What i need to know is how to save image from folder into database. In case of file upload i know what to do.I make an instance of HttpPostedFile and then use it to save file but what should i use here ??
AmitGajjar 30-Aug-12 1:37am    
What you need to do is to Convert your image into Byte Array and pass it as an SP argument. you can create Image type column in the database. is this what you want to know ?
AmitGajjar 30-Aug-12 1:38am    
But if you are using latest SQL server version then Image data type is removed instead you can use varbinary(max).
You need to use the file upload control.
Refer the below article
File Upload with ASP.NET[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900