Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I made program in vb to download zip file form the internet

but the problem is after the download completed can't open any file Error
c:\download\call.zip
The archive is either in unknown format or damaged


this is the code

Imports System.Net
Public Class Form1
    Private WithEvents httpclient As WebClient
 
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Button1.Enabled = False
        httpclient = New WebClient
        AddHandler httpclient.DownloadFileCompleted, AddressOf Downloaded
        httpclient.DownloadFileAsync(New Uri("https://www.download source.com/call.zip"), ("C:\download\call.zip"))
    End Sub
 
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        persent.Text = ""
    End Sub
 
    Private Sub dpc(ByVal sender As Object, ByVal e As System.Net.DownloadProgressChangedEventArgs) Handles httpclient.DownloadProgressChanged
        persent.Text = e.ProgressPercentage
    End Sub
 
    Private Sub Downloaded()
        If System.IO.File.Exists("C:\download\call.zip") = True Then
            Process.Start("C:\download\call.zip")
        Else
            MsgBox("Doesn't exist", 64, "Open")
        End If
    End Sub
End Class


can anyone help thanks.
Posted
Comments
[no name] 26-Apr-14 18:40pm    
Does it work if you just use "http"?
Member 10772644 26-Apr-14 22:01pm    
yeah same

The first thing to do is try it manually, using a browser: does the file look the same, is it the same size? and so forth.

If it is, then try opening it as you have shown here. If it still fails, it may be the file format that is a problem: WinZip introduced a compression format a couple of years ago that a lot of systems have yet to catch up to yet and it may be that is your problem with that specific archive.

If the newly downloaded file works fine, then you need to look at the differences between the manually downloaded and the auto downloaded versions.
 
Share this answer
 
Thanks it's working now the problem is dropbox.com I think doesn't allow direct download link so I try mediafire.com It's working.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900