how to read word document before uploading it by webpage

Total Post:70

Points:494
 1147  View(s)
Ratings:
Rate this:

how to read word document before uploading it by webpage

  1. Post:378

    Points:2694
    Re: how to read word document before uploading it by webpage

    Hi Samuel ,


    You probably need an ActiveX Object to access the file content on the client system before uploading.

    function CheckWordDoc(filepath){
        var fso, f, ts, s;
        var ForReading = 1, ForWriting = 2, ForAppending = 8;
        var TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0;
        fso = new ActiveXObject("Scripting.FileSystemObject");
        f = fso.getFile(filepath);
        ts = f.OpenAsTextStream(ForReading, TristateUseDefault);
        while (!ts.AtEndOfStream) {
            s = ts.ReadLine();
            if (s.indexOf("Word.Document.8") != -1) {
                ts.Close( );
                return true;
            }
        }         
        ts.Close( );
        return false;
    }

      Modified On Apr-04-2018 06:27:52 AM

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!