|
-
Jan 6th, 2008, 08:56 AM
#1
Thread Starter
Addicted Member
How to check if a file exists, if doesn't exists, then download it?
How to check if a file exists, if doesn't exists, then download it?
-
Jan 6th, 2008, 10:15 AM
#2
Re: How to check if a file exists, if doesn't exists, then download it?
i believe it's like this.
Code:
Option Explicit
Private Sub Command1_Click()
On Error GoTo err
Dim gifbyt() As Byte
Dim i As Integer
Dim fno As Long
Inet1.Execute "http://www.codeguru.com/forum/images/cg-logo.gif", "GET"
While Inet1.StillExecuting
DoEvents
'Wait for it to stop executing
Wend
If Inet1.GetHeader("Content-length") = "" Then
MsgBox "File Not found"
Else
gifbyt() = Me.Inet1.OpenURL("http://www.codeguru.com/forum/images/cg-logo.gif", icByteArray)
'Ritrived the gif file as Bytes of Array
'Creating an empty gif file and write the bytes in to it.
fno = FreeFile()
Open "c:\logo.gif" For Binary Access Write As #fno
Put #fno, , gifbyt()
Close #fno
MsgBox "Downlod Complete"
End If
Exit Sub
err:
MsgBox err.Description
End Sub
Last edited by Fazi; Jan 6th, 2008 at 11:09 AM.
-
Jan 6th, 2008, 04:36 PM
#3
Thread Starter
Addicted Member
Re: How to check if a file exists, if doesn't exists, then download it?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|