displaying clients machine folder and files

Discussion in 'HTML' started by nagendrababuv@gmail.com, Nov 30, 2005.

  1. Guest

    hello

    I have attached a javascript file my name folder.js. what i am doing
    in this .js file is i am passing the path of the directory and listing
    them in the html table, again if there is any subfolder in that i
    create a link and call (folderdisp(path)) this function recurrsively.
    But problem is that i am not able to refresh the page, i have lost the
    hook of the page also please have a look at this or Guide me
    how i can display the client machine folder on a browser and navigate
    to its subfolder so that i dont loose te hook of that .aspx page.
    Thanks in advance.

    function folderdisp(path)
    {

    //window.alert("Start :"+ path);

    var fso = new ActiveXObject('Scripting.FileSystemObject');

    if(fso.FolderExists(path) == true)
    {
    document.write ("<html><head>");
    document.write ("<br><br><br><br><br>");
    document.write ("Files are downloaded to path " +path);
    document.write ("<script language=javascript
    src="+"\""+"folder.js"+"\""+"></script>");
    document.write ("<script language=vbscript
    src="+"\""+"openfolder.vbs"+"\""+"></script>");
    document.write ("</head>");
    document.write("<table Border=0 align =left CellPadding=2>" );
    document.write("<tr bgcolor= #FFFFCC align =
    center><td>"+"FolderName"+"</td>","<td>"+"Ext"+"</td>", "<td>"+"Created
    Date"+"</td>", "<td>"+"Size"+"</td></tr>");

    var fold = fso.GetFolder(path);

    filesArrayString = '';

    //Find subfolders
    for (subfol = new Enumerator(fold.SubFolders);!subfol.atEnd();
    subfol.moveNext())
    {
    var folname = subfol.item();

    var nextfol = path+"/"+folname.name;
    //window.alert("nextfol = "+nextfol);
    var day,month,year,hrs,min;
    DateC = new Date(folname.DateCreated);
    day = DateC.getUTCDate();
    month = DateC.getUTCMonth()+1;
    year = DateC.getUTCFullYear();
    hrs = DateC.getUTCHours();
    min = DateC.getUTCMinutes();
    var DispDate = day + "/" + month + "/" + year+" "+hrs+":"+min;

    //window.alert("Here :"+ nextfol);


    document.write ("<tr bgcolor= #FFDBCA><td>"+"<A
    href="+"\""+"#"+"\""+"
    onClick="+"\""+"folderdisp('"+nextfol+"');"+"\""+">"+folname.name+"</A></td>","<td>Dir</td>","<td>"+DispDate+"</td>","<td>"+folname.Size+"</td></tr>");
    window.alert("Folder end");
    }

    //Find files
    for (files = new Enumerator(fold.files); !files.atEnd();
    files.moveNext())
    {
    //window.alert("file");
    var thisFile = files.item();
    var Fname = thisFile.name.split(".");
    var fileDateC = new Date(thisFile.DateLastModified);
    var fileday = fileDateC.getUTCDate();
    var filemonth = fileDateC.getUTCMonth()+1;
    var fileyear = fileDateC.getUTCFullYear();
    var filehrs = fileDateC.getUTCHours();
    var filemin = fileDateC.getUTCMinutes();

    var fileDispDate = fileday + "/" + filemonth + "/" + fileyear +"
    "+filehrs+":"+ filemin ;

    filepath = path+"/"+Fname[0]+"."+Fname[1];

    //document.write ("<tr bgcolor=
    #FFCAE4><td>"+Fname[0]+"</td><td>"+Fname[1]+"</td><td>"+fileDispDate+"</td><td>"+thisFile.Size+"</td></tr>");

    //document.write ("<tr bgcolor= #FFCAE4><td><A href='#'
    onClick="+"\""+"vbscript:eek:penArtPDF()"+"\""+">"+Fname[0]+"</A></td><td>"+Fname[1]+"</td><td>"+fileDispDate+"</td><td>"+thisFile.Size+"</td></tr>");

    document.write ("<tr bgcolor= #FFCAE4><td><A href="+"\""+"#"+"\""+"
    onClick="+"\""+"openArtPDF('"+filepath+"');"+"\""+"
    >"+Fname[0]+"</A></td><td>"+Fname[1]+"</td><td>"+fileDispDate+"</td><td>"+thisFile.Size+"</td></tr>");



    }
    document.write("</table>");
    document.write ("</html>");
    }

    else
    {
    window.alert("Folder does not exist in local");
    }



    }
     
    , Nov 30, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Francesco
    Replies:
    1
    Views:
    548
    =?ISO-8859-1?Q?Arne_Vajh=F8j?=
    Dec 27, 2006
  2. Replies:
    7
    Views:
    413
    Gabriel Genellina
    Sep 25, 2007
  3. Jochen Brenzlinger
    Replies:
    5
    Views:
    977
    Roedy Green
    Sep 2, 2011
  4. Purva
    Replies:
    0
    Views:
    127
    Purva
    Dec 28, 2005
  5. Replies:
    0
    Views:
    124
Loading...

Share This Page