Jump to content

File exists or not using javascript..

Recommended Posts

I want to check the file exists or not at the path pointing at file..?? <li><a onclick="db_mcmm('../report_data_fe_nldm_completeness/DB_existence_PVT_report.html');"><h3><u>DB NLDM MCMM</u></h3></a></li> Above is snippet of code from html. The path to file is given as argument to the javascript function defined in header section of html. I want to check to if the "DB_existence_PVT_report.html" file exists or not. Javascript function in header section is as follows : <script ="text/javascript"> function db_mcmm(value) { var mcmm_file=document.getElementById('content'); mcmm_file.innerHTML= "<iframe src=" + value + " width=\"79%\" height=\"600px\"></iframe>"; } </script> Can some1 guide how i can check if file exists or not..?? I tried using ajax but didn't got how to use ajax in this.... any help will be thankful

Link to post
Share on other sites

Using javascript with server language as with AJAX, you are opening yourself for distructive scenarios, involving hacking and such like, using JS on it own is very limited, and checking if file exists is not avaiable I don't believe, and how to do it in PHP link AGAIN! study google, if problems come back! http://www.w3schools...file_exists.asp

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...