upload image to sql server
-
I want to upload an image to sqlserver, i use fileupload control and upload the image. But when I retrieve it to gideview it appears as a text: System.Byte[] How can i solve this problem.. thanks
-
I always say that it is better to store the file location of the image in your database rather then the actual image. This means that your database doesnt become bloated and at the same time you can retrieve the image in almost the same way.
Could you explaine more what you mean. Im using the following code to upload the file is there any mistake. Dim imageBytes(FileUpload1.PostedFile.InputStream.Length) As Byte FileUpload1.PostedFile.InputStream.Read(imageBytes, 0, imageBytes.Length) myCommand.Parameters.AddWithValue("@ImageData", imageBytes) thanks
-
I always say that it is better to store the file location of the image in your database rather then the actual image. This means that your database doesnt become bloated and at the same time you can retrieve the image in almost the same way.
I used to think that way however .. have a look at the following thread ... http://www.codeproject.com/Lounge.aspx?msg=2769169#xx2769169xx[^]
-
Could you explaine more what you mean. Im using the following code to upload the file is there any mistake. Dim imageBytes(FileUpload1.PostedFile.InputStream.Length) As Byte FileUpload1.PostedFile.InputStream.Read(imageBytes, 0, imageBytes.Length) myCommand.Parameters.AddWithValue("@ImageData", imageBytes) thanks