?
Solved

How to detect if  a file doesn't exist on a remote website.

Posted on 2003-11-14
6
Medium Priority
?
190 Views
Last Modified: 2013-12-24
I have an image showing currency rateson my site and it is  updated  hourly on a remote site. However the other site is having problems and sometimes the graphic is not existant.

I don't want a broken link appearing on my site. Is there anyway I can detect whether the graphic is there or mot?
0
Comment
Question by:kjuliff
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
6 Comments
 

Expert Comment

by:CarlsonCo
ID: 9749866
Use the FileExists() function.
0
 
LVL 1

Author Comment

by:kjuliff
ID: 9749934
But the file is not in a directory at my site.
0
 

Expert Comment

by:CarlsonCo
ID: 9749981
Oops, I see what you mean.  Hmmm...I've done this before in Java.  Let me check into it.
0
Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

 

Accepted Solution

by:
CarlsonCo earned 750 total points
ID: 9750044
This should work:

<cfset ImageExists = "True">
<cftry>
      <cfhttp url="http://i.a.cnn.net/cnn/.element/img/1.1/logo/logo.gif"
            method="GET"
            resolveurl="Yes"
            throwOnError="Yes"/>
<cfcatch type="Any">
      <cfset ImageExists = "False">
</cfcatch>
</cftry>
<br>Image exists? #ImageExists#<br>

0
 
LVL 17

Expert Comment

by:anandkp
ID: 9752912
yes CFHTTP shld help u with it

But i wld say - since ur updating ur site every hour ... sooner or later the user will get the real image - right !

so to avoid teh errors popping up - use CFERROR to show friendly error messages & let the user know that in few minutes he can have the image - which is not currently updated on the server.

u can also change the updates from hourly to every 10 minutes so as to avoid the error ratio !

just a thought !
0
 

Expert Comment

by:CarlsonCo
ID: 9764126
There is a disadvantage to the method I suggested in that it downloads the image to your Web server as well as your clients browser.  That added bandwidth takes a hit on your Web site and doubly on the source host.  Of course, it depends on the size of the image.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question