Visa ett inlägg
Oläst 2009-10-09, 17:18 #1
Logan Logan är inte uppkopplad
Nykomling
 
Reg.datum: Aug 2004
Inlägg: 44
Logan Logan är inte uppkopplad
Nykomling
 
Reg.datum: Aug 2004
Inlägg: 44
Tool WebService VB.NET

Sitter och jobbar lite med WebService i VB.NET
Jag har ett litet problem.

PHP: chunk_split(base64_encode(file_get_contents("denna .jpg")));

VB.NET: <WebMethod()> Public Function Upload(ByVal ImageData As Byte()) As Boolean

XML: <ImageData>base64Binary</ImageData>

Hur ska jag spara den datan som kommer in i Upload till en JPEG fil?

Jag har följande kod nu.

Dim FilePath As String = "C:\denna.jpg"

If IsNothing(ImageData) = True Then
Return False
End If
Try
Dim fs As IO.FileStream = New IO.FileStream(FilePath, IO.FileMode.OpenOrCreate, IO.FileAccess.Write)
Dim bw As IO.BinaryWriter = New IO.BinaryWriter(fs)
bw.Write(ImageData, 0, ImageData.Length)
bw.Flush()
bw.Close()
fs.Close()
bw = Nothing
fs.Dispose()
Return True
Catch ex As Exception
Return False
End Try


Det skapas en fil, som en txt fil fast med .jpg?
Logan är inte uppkopplad   Svara med citatSvara med citat