Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Testing if a file exist

Status
Not open for further replies.

nkamp

Programmer
Jan 19, 2004
35
0
0
NL
Hello,

I'm maintaining a application. In this application there a files (like .doc, .txt, .jpg) opened with:
Code:
setFrame('frm_file', '/ALGEBESTANDEN/' + file_link);

Where file_link is a variable wich is comming from sql-server database.
But now somebody has deleted the file, while the name is still in the database.
Is there in Javascript a opportunity to test if the file exist like:
Code:
if (getFile(file_link) != null)
{
   //the operation
}

Can anybody help me with this.

Thanks in advance.

Greetings,

Nico
 
If the file is on a server, and is an image file, you could try to load it, harnessing the onerror event of the imange object. If it's not an image (or even if it is), you would be better off doing this detection server-side.

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top