By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,056 Members | 1,320 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,056 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)

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

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).


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.