Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

File seek in Javascript (FileSystemObject)

810208Nov 3 2010 — edited Nov 3 2010
Hello,

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!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 1 2010
Added on Nov 3 2010
1 comment
622 views