I am saving image files from my website using the downloaddata on the web
client. This gives me a byte array, which I am then saving to a file with
the following code:
' Create the new, empty data file.
If File.Exists(Img Dest) Then
Console.WriteLi ne("{0} already exists!", ImgDest)
Return
End If
Dim fs As New FileStream(ImgD est, FileMode.Create New)
' Create the writer for data.
Dim w As New BinaryWriter(fs )
' Write data to Test.data.
w.Write(ImgArra y)
w.Close()
fs.Close()
This works, in that I end up with the file(s) on my machine, but if I try
and open them they come up as invalid. Any clues? Am I missing a step to do
with image headers or something?
James.
client. This gives me a byte array, which I am then saving to a file with
the following code:
' Create the new, empty data file.
If File.Exists(Img Dest) Then
Console.WriteLi ne("{0} already exists!", ImgDest)
Return
End If
Dim fs As New FileStream(ImgD est, FileMode.Create New)
' Create the writer for data.
Dim w As New BinaryWriter(fs )
' Write data to Test.data.
w.Write(ImgArra y)
w.Close()
fs.Close()
This works, in that I end up with the file(s) on my machine, but if I try
and open them they come up as invalid. Any clues? Am I missing a step to do
with image headers or something?
James.
Comment