how to read this file

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Nov 2008
Posts: 21
Reputation: the_swan is an unknown quantity at this point 
Solved Threads: 0
the_swan the_swan is offline Offline
Newbie Poster

how to read this file

 
0
  #1
Dec 7th, 2008
hiiiiiiiiiiiiiiii

I'm going to store a selected image from fileupload
and save the image in a array of byte in a file

"the code"

Dim _fileName As String = Request.PhysicalApplicationPath & FileUpload1.FileName
Dim _byte() As Byte = FileUpload1.FileBytes()
Dim _file As New IO.FileStream(_fileName, IO.FileMode.Create)

For _i As Integer = 0 To _byte.Length - 1
_file.WriteByte(_byte(_i))

my problem is how to read this file ???
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 710
Reputation: Teme64 will become famous soon enough Teme64 will become famous soon enough 
Solved Threads: 115
Teme64's Avatar
Teme64 Teme64 is offline Offline
Master Poster

Re: how to read this file

 
0
  #2
Dec 8th, 2008
Here's an easier way to do that:
  1. ' Write byte array
  2. My.Computer.FileSystem.WriteAllBytes(_fileName, _byte, False)
  3. ' Read byte array
  4. _byte = My.Computer.FileSystem.ReadAllBytes(_fileName)
But if you still want to use the FileStream:
  1. Dim _FileSize As Long
  2. _FileSize = _file.Length
  3. For _i As Long = 0 To _FileSize - 1
  4. _byte(CInt(_i)) = CByte(_file.ReadByte())
  5. Next _i
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 642 | Replies: 1
Thread Tools Search this Thread



Tag cloud for VB.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC