1
Reply

open file from client, get the byte of array then save to server

hendyhanusin

hendyhanusin

Mar 21 2007 12:55 AM
2.2k
Dear friend,

As you know that ASP .NET has client side and server side...
it means that we can get and open a file from client (C:\jaguar.jpg) then get the byte of array, then we save it to the server (Server.MapPath(Request.ApplicationPath) & "\Images\HORE.jpg")...
i tried the following code, but it does not work properly when we open the file from client...
Pls help...
Thank you,
hendy

=======source code ===============

                Dim s As Stream = File.OpenRead("C:\jaguar.jpg")
                Dim buffer(s.Length) As Byte
                s.Read(buffer, 0, CType(s.Length, Integer))
                Dim len As Integer = CType(s.Length, Integer)
                s.Close()
                Dim fs As FileStream = New FileStream(Server.MapPath(Request.ApplicationPath) & "\Images\HORE.jpg", FileMode.Create)
                fs.Write(buffer, 0, len)
                fs.Close()

Answers (1)