Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. upload image to sql server

upload image to sql server

Scheduled Pinned Locked Moved ASP.NET
databasesql-serversysadminhelpquestion
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    y_mmohd
    wrote on last edited by
    #1

    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

    E 1 Reply Last reply
    0
    • Y y_mmohd

      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

      E Offline
      E Offline
      eyeseetee
      wrote on last edited by
      #2

      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.

      Y M 2 Replies Last reply
      0
      • E eyeseetee

        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.

        Y Offline
        Y Offline
        y_mmohd
        wrote on last edited by
        #3

        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

        S 1 Reply Last reply
        0
        • E eyeseetee

          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.

          M Offline
          M Offline
          Michael Bookatz
          wrote on last edited by
          #4

          I used to think that way however .. have a look at the following thread ... http://www.codeproject.com/Lounge.aspx?msg=2769169#xx2769169xx[^]

          1 Reply Last reply
          0
          • Y y_mmohd

            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

            S Offline
            S Offline
            sumit7034
            wrote on last edited by
            #5

            Have u Tried this... FileUpload1.FileBytes;

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups