File seek in Javascript (FileSystemObject)
810208Nov 3 2010 — edited Nov 3 2010Hello,
I have a HTML page with Javascript, which is trying to handle a file which is on the server. For this purpose I am using ActiveX - FileSystemObject.
I am trying to open this binary file and add some data in a specific position (after byte 29). This is my code:
function exportFile(text,myPath)
{
var fso, f2;
fso = new ActiveXObject("Scripting.FileSystemObject");
f2 = fso.OpenTextFile(myPath,8);
f2.Skip(29);
f2.Write(text);
f2.Close;
}
But I get this problems:
- Data is added only at the end of the file, I cannot seek the byte 29 before writing.
- I'm afraid that opening the file with "OpenTextFile" I won't be able to write any byte (only text). Right?
- On Internet Explorer I always get some "security advices" and it doesn't work in any other browser.
- Is there any Javascript alternative to do the same?
THANKS A LOT!