how to read word document before uploading it by webpage
how to read word document before uploading it by webpage
1787
22-Aug-2014
Sumit Kesarwani
22-Aug-2014You 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;
}