Check if file exists in HTTP/Weblink

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ykhamitkar
    New Member
    • May 2007
    • 64

    Check if file exists in HTTP/Weblink

    Hi there,

    Could you please advice whats the code to check if the file exists on a website (HTTP)

    Thanks
    Yogesh
  • puppydogbuddy
    Recognized Expert Top Contributor
    • May 2007
    • 1923

    #2
    Try this function I found a while ago on http:/Q_20882190.html can help you out. it checks if a certain internet address exist.

    Private Declare Function InternetCheckCo nnection _
    Lib "wininet.dl l" _
    Alias "InternetCheckC onnectionA" _
    (ByVal lpszUrl As String, _
    ByVal dwFlags As Long, _
    ByVal dwReserved As Long) As Long


    Public Function blnAPI_URL_Exis ts(ByVal strURL As String) As Boolean
    'However, should a page not be found (i.e. a 404 error) and the particular site
    'is set-up to redirect to a bespoke "404 page" then you may actually receive a false
    'result in that the redirection page does exist (even though the original page did not).

    Const FLAG_ICC_FORCE_ CONNECTION As Long = &H1

    blnAPI_URL_Exis ts = (InternetCheckC onnection(strUR L, FLAG_ICC_FORCE_ CONNECTION, 0&) <> 0&)

    End Function

    Comment

    Working...