943,741 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 883
  • VB.NET RSS
Dec 7th, 2008
0

how to read this file

Expand Post »
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 ???
Similar Threads
Reputation Points: 7
Solved Threads: 0
Newbie Poster
the_swan is offline Offline
21 posts
since Nov 2008
Dec 8th, 2008
0

Re: how to read this file

Here's an easier way to do that:
VB.NET Syntax (Toggle Plain Text)
  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:
VB.NET Syntax (Toggle Plain Text)
  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
Reputation Points: 218
Solved Threads: 201
Veteran Poster
Teme64 is offline Offline
1,024 posts
since Aug 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: Help with Visual Studio 2008
Next Thread in VB.NET Forum Timeline: Query and text file





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC