I am currently retrieveing files from another server via cfhttp. Occasionally,
the files get renamed and my script throws an error. How can I verify if a
file exists on a remote server before I make the cfhttp connection?
Azadi - 19 May 2008 18:59 GMT
check the statuscode returned in the cfhttp structure: 200 means file is
there.
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Magikaru - 19 May 2008 19:41 GMT
I had to deal with the same problem about a week ago.
Here's how I got around it:
<cftry>
<cfhttp method="head" name="testTheFile" url="myurl.html"></cfhttp>
<!--- If code reaches this point, File Exists --->
<cfcatch>
<!--- File does not exist --->
</cfcatch>
</cftry>