GarethABC
asked on
downloading file using WebClient
Hi all
I am trying to download a file from a website and saving it to our server.
All works ok using the following code but the file is back to front compared to the original, ie page 10 is page 1 and vice versa
Any ideas why? The file is a tif file if that helps
Thanks in advance
I am trying to download a file from a website and saving it to our server.
All works ok using the following code but the file is back to front compared to the original, ie page 10 is page 1 and vice versa
Any ideas why? The file is a tif file if that helps
Thanks in advance
Protected Function createFile(ByVal url As String, ByVal saveFilePath As String) As Boolean
Try
Dim c As New WebClient()
c.DownloadFile(url, saveFilePath)
Return True
Catch ex As Exception
Return False
End Try
End Function
Try using byte, fliestream..
Dim wc As New Net.WebClient()
wc.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials
Dim buff As Byte() = wc.DownloadData(fileUrl)
Using fs As System.IO.FileStream = New FileStream("C:\test\img.tif", FileMode.Create)
fs.Write(buff, 0, buff.Length)
fs.Close()
End Using
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
see above
c.DownloadData
check the recevied bytes size.
and save to file
Compare results.