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 a xls, doc, jpeg... to SQL DB with asp.net(vb code behind)

upload a xls, doc, jpeg... to SQL DB with asp.net(vb code behind)

Scheduled Pinned Locked Moved ASP.NET
databasecsharpasp-nettutorial
2 Posts 2 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.
  • L Offline
    L Offline
    ljhopkins
    wrote on last edited by
    #1

    :wtf:I do not know c# so the code here on this site is just confusing is there any one who has examples of code on how to upload docs(xls, doc, txt) to a sql database using vb code behind TOTAL CONFUSED

    J 1 Reply Last reply
    0
    • L ljhopkins

      :wtf:I do not know c# so the code here on this site is just confusing is there any one who has examples of code on how to upload docs(xls, doc, txt) to a sql database using vb code behind TOTAL CONFUSED

      J Offline
      J Offline
      jnstaub
      wrote on last edited by
      #2

      If Not IsNothing(mabanniere.PostedFile) Then filtype = Right(mabanniere.PostedFile.FileName, 3) mabanniere.PostedFile.SaveAs("c:/temp/banniere." & filtype) Dim photo() As Byte = GetPhoto("c:/temp/banniere." & filtype) Me.SqlInsertsociete.Parameters("@BANNER").Value() = photo FileSystem.Kill("c:/temp/banniere." & filtype) End If Public Shared Function GetPhoto(ByVal filePath As String) As Byte() Dim fs As New System.IO.FileStream(filePath, System.IO.FileMode.Open, System.IO.FileAccess.Read) Dim br As New System.IO.BinaryReader(fs) Dim photo() As Byte = br.ReadBytes(fs.Length) fs.Read(photo, 0, fs.Length) br.Close() fs.Close() Return photo getphoto transform a file to a byte array. my upload control name is mabanniere regards

      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