By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,483 Members | 1,939 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,483 IT Pros & Developers. It's quick & easy.

Check if file exists in HTTP/Weblink

P: 64
Hi there,

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

Thanks
Yogesh
Feb 6 '09 #1
Share this Question
Share on Google+
1 Reply


puppydogbuddy
Expert 100+
P: 1,923
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 InternetCheckConnection _
Lib "wininet.dll" _
Alias "InternetCheckConnectionA" _
(ByVal lpszUrl As String, _
ByVal dwFlags As Long, _
ByVal dwReserved As Long) As Long


Public Function blnAPI_URL_Exists(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_Exists = (InternetCheckConnection(strURL, FLAG_ICC_FORCE_CONNECTION, 0&) <> 0&)

End Function
Feb 9 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.