Click here to Skip to main content
15,892,161 members
Home / Discussions / Web Development
   

Web Development

 
AnswerRe: Javascript and database Pin
Bradml29-Nov-06 11:43
Bradml29-Nov-06 11:43 
AnswerRe: Javascript and database Pin
Dominic Pettifer29-Nov-06 13:34
Dominic Pettifer29-Nov-06 13:34 
AnswerRe: Javascript and database Pin
Torsten Mauz30-Nov-06 2:26
Torsten Mauz30-Nov-06 2:26 
GeneralRe: Javascript and database Pin
Dominic Pettifer30-Nov-06 11:42
Dominic Pettifer30-Nov-06 11:42 
QuestionWYSIWYG HTML Editor Pin
sam31529-Nov-06 10:09
sam31529-Nov-06 10:09 
AnswerRe: WYSIWYG HTML Editor Pin
Infomine Liam29-Nov-06 13:00
Infomine Liam29-Nov-06 13:00 
QuestionJavascript file existing checking [modified] Pin
Clickok29-Nov-06 6:47
Clickok29-Nov-06 6:47 
AnswerRe: Javascript file existing checking Pin
Torsten Mauz29-Nov-06 10:12
Torsten Mauz29-Nov-06 10:12 
Well I just hacked this together off the top of my head so it may/may not work properly, but it should get you pointed in the right direction.

I would advise you not to go down this road though. In order to get access to the filesystem, the users are required to set their browser's security settings extremely low. This is clearly not a good idea. That's why it's a default setting to have access to this stuff. It's also why you can't do much with file input boxes using javascript. It poses a huge security risk and I repeat I advise you not head down this road. Perhaps if you explained your reasons for wanting to do this we could offer some alternative solutions/ideas.

var filePath = 'c:\\test.txt';

if (navigator.userAgent.indexOf('MSIE') == -1 && Components)
{
    try 
    { 
        netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');

        var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
        file.initWithPath(filePath);
        if (file.exists()) 
        {
            alert('Found!');
        }
        else
        {
            alert('Not found!');
        }
    }
    catch(e)
    {
        alert(e);
    }
}
else
{   
    try
    {
        var objA = new ActiveXObject('Scripting.FileSystemObject');
        if(objA.FileExists(filePath))
        {
            alert('Found!');
        }
        else
        {
            alert('Not found!');
        }
    }
    
    catch(e)
    {
        alert(e.message);
    }
}


The IE stuff will work definately work, but I haven't tested the mozilla code (only have IE installed atm), so not too sure if that will work straight away or not, at the least it should point you in the right direction.

HTH
GeneralRe: Javascript file existing checking Pin
Clickok29-Nov-06 11:34
Clickok29-Nov-06 11:34 
GeneralRe: Javascript file existing checking Pin
Torsten Mauz29-Nov-06 11:46
Torsten Mauz29-Nov-06 11:46 
GeneralRe: Javascript file existing checking Pin
Clickok29-Nov-06 11:54
Clickok29-Nov-06 11:54 
GeneralRe: Javascript file existing checking Pin
Torsten Mauz30-Nov-06 1:35
Torsten Mauz30-Nov-06 1:35 
QuestionWORD SEARCHING AND LISTING CODE ON HTML PAGES [modified] Pin
MARSHAX29-Nov-06 1:18
MARSHAX29-Nov-06 1:18 
GeneralASP.NET Caching Problem Pin
Brady Kelly29-Nov-06 0:27
Brady Kelly29-Nov-06 0:27 
GeneralRe: ASP.NET Caching Problem Pin
Torsten Mauz29-Nov-06 11:59
Torsten Mauz29-Nov-06 11:59 
QuestionHow to use CDONTS in UNIX Server using ASP Pin
Debi Prasad28-Nov-06 23:42
Debi Prasad28-Nov-06 23:42 
AnswerRe: How to use CDONTS in UNIX Server using ASP Pin
Bradml29-Nov-06 0:09
Bradml29-Nov-06 0:09 
GeneralRe: How to use CDONTS in UNIX Server using ASP Pin
Brady Kelly29-Nov-06 0:28
Brady Kelly29-Nov-06 0:28 
QuestionAbout the CodeProject page "script/comments/user_reply.asp" Pin
Davids_Maguire28-Nov-06 22:07
Davids_Maguire28-Nov-06 22:07 
AnswerRe: About the CodeProject page "script/comments/user_reply.asp" Pin
Guffa29-Nov-06 0:16
Guffa29-Nov-06 0:16 
GeneralRe: About the CodeProject page "script/comments/user_reply.asp" Pin
Davids_Maguire29-Nov-06 1:22
Davids_Maguire29-Nov-06 1:22 
AnswerRe: About the CodeProject page "script/comments/user_reply.asp" Pin
Guffa29-Nov-06 13:21
Guffa29-Nov-06 13:21 
Questionproblem with frame levels Pin
Wim Engberts28-Nov-06 22:00
Wim Engberts28-Nov-06 22:00 
AnswerRe: problem with frame levels Pin
Bradml28-Nov-06 22:44
Bradml28-Nov-06 22:44 
GeneralRe: problem with frame levels Pin
Wim Engberts28-Nov-06 22:50
Wim Engberts28-Nov-06 22:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.