Home All Groups Group Topic Archive Search About
Author
3 Mar 2006 4:08 PM
Jon
We have a regular ASP website that uses the third party ASPUpload control
for uploading files. Those files are in the byte array format, ready to be
stored into SQL Server. I need to transfer that byte array to a .Net (2.0)
DLL (through COM) and then convert it to a filestream so that I can write it
to a directory on the server. I'm having trouble figuring out how to do
that.

Anyone have some ideas on the best way to do that?

Thanks
Jon

Author
3 Mar 2006 4:36 PM
zacks
MemoryStream maybe?
Author
4 Mar 2006 8:56 AM
rmacias
Here the basic idea.  I'd recommend extra checks to see if path exists,
exception handling, etc.

Public Sub CreateFileFromBytes(ByVal fileAsBytes() As Byte, ByVal
pathToWrite As String)

        Dim fs As FileStream = New FileStream(pathToWrite, FileMode.CreateNew)
        fs.Write(fileAsBytes, 0, fileAsBytes.Length)
        fs.Flush()
        fs.Close()

End Sub

Show quoteHide quote
"Jon" wrote:

> We have a regular ASP website that uses the third party ASPUpload control
> for uploading files. Those files are in the byte array format, ready to be
> stored into SQL Server. I need to transfer that byte array to a .Net (2.0)
> DLL (through COM) and then convert it to a filestream so that I can write it
> to a directory on the server. I'm having trouble figuring out how to do
> that.
>
> Anyone have some ideas on the best way to do that?
>
> Thanks
> Jon
>
>
>