use db(sql server2000) for storing images
-
i am developing a web app and is it better to use db(sql server2000) for storing images or use a folder for storing the images? I want to know also for flash files. plz help
-
i am developing a web app and is it better to use db(sql server2000) for storing images or use a folder for storing the images? I want to know also for flash files. plz help
Storing them on the file system certainly makes for less strain on your site, it depends on what your requirements are.
Christian Graus Driven to the arms of OSX by Vista.
-
i am developing a web app and is it better to use db(sql server2000) for storing images or use a folder for storing the images? I want to know also for flash files. plz help
if u store those images in a folder it will very easy. but some complexity also there if somebody delete that folder. or else u can store images in database that is difficult but more flexible and relable. so my suggetion is to store in database directly. use below code to store the images in database. If fileImgUpload.PostedFile.ContentLength = 0 Then lblmsg.Visible = True lblmsg.Text = "Please Browse for the New Image/Photo......." lblmsg.ForeColor = Drawing.Color.Red Exit Sub End If openAccessConnection() Dim imageSize As Int64 Dim imageType As String Dim imageStream As Stream ' Gets the Size of the Image imageSize = fileImgUpload.PostedFile.ContentLength ' Gets the Image Type imageType = fileImgUpload.PostedFile.ContentType ' Reads the Image stream imageStream = fileImgUpload.PostedFile.InputStream Dim imageContent(imageSize) As Byte Dim intStatus As Integer intStatus = imageStream.Read(imageContent, 0, imageSize) Dim cmd As New OleDbCommand("insert into tblImg(img_title,img_type,img_stream) values(@img_title,@img_type,@img_stream)", myAccessConnection) cmd.CommandType = CommandType.Text cmd.Parameters.Add("@img_title", OleDbType.VarChar).Value = txt_title.Text.Replace(",", """") cmd.Parameters.Add("@img_type", OleDbType.VarChar).Value = imageType cmd.Parameters.Add("img_stream", OleDbType.LongVarWChar).Value = Convert.ToBase64String(imageContent) cmd.ExecuteNonQuery() closeAccessConnection() txt_title.Text = "" lblmsg.Visible = True lblmsg.ForeColor = Drawing.Color.Green lblmsg.Text = "Photo Uploaded Successfully......" displayImages()
-
i am developing a web app and is it better to use db(sql server2000) for storing images or use a folder for storing the images? I want to know also for flash files. plz help
Subin Alex wrote:
i am developing a web app and is it better to use db(sql server2000) for storing images or use a folder for storing the images?
I would suggest you to store images in folder and store the image path in database.
cheers, Abhijit CodeProject MVP