Solved

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

Posted on 2003-11-14
6
188 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
Free NetCrunch network monitor licenses!

Only on Experts-Exchange: Sign-up for a free-trial and we'll send you your permanent license!

Here is what you get: 30 Nodes | Unlimited Sensors | No Time Restrictions | Absolutely FREE!

Act now. This offer ends July 14, 2017.

 

Accepted Solution

by:
CarlsonCo earned 250 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

Manage your data center from practically anywhere

The KN8164V features HD resolution of 1920 x 1200, FIPS 140-2 with level 1 security standards and virtual media transmissions at twice the speed. Built for reliability, the KN series provides local console and remote over IP access, ensuring 24/7 availability to all servers.

Question has a verified solution.

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

Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

691 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