/t5/coldfusion-discussions/cfhttp-verify-file-first/td-p/856325May 19, 2008
May 19, 2008
Copy link to clipboard
Copied
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?
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>
/t5/coldfusion-discussions/cfhttp-verify-file-first/m-p/856327#M78994May 19, 2008
May 19, 2008
Copy link to clipboard
Copied
LATEST
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>